TogglePlayerControllable
Holds or releases the player’s keyboard.
false freezes the player where they stand: the keyboard does nothing on their client, the mouse still looks around,
T and Enter still open the chat. true gives the keyboard back. The server’s own login hold uses the same lever
for a registered name until its /login.
Syntax
Section titled “Syntax”TogglePlayerControllable(pid, controllable)| Parameter | Type | |
|---|---|---|
pid |
number | the player |
controllable |
boolean | false holds, true releases |
Returns
Section titled “Returns”boolean - false when not connected
Example
Section titled “Example”-- freeze everyone for the countdownfor _, pid in ipairs(GetPlayers()) do TogglePlayerControllable(pid, false) endSetTimer(function() for _, pid in ipairs(GetPlayers()) do TogglePlayerControllable(pid, true) end GameTextForAll("Go!", 1500)end, 3000)See also
Section titled “See also”IsPlayerControllable · SetPlayerVirtualWorld · the Players group of the index
