Skip to content

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, Enter still opens the chat and its scroll keys (Page Up / Page Down unless the player changed them) still move it. true gives the keyboard back. The server’s own login hold uses the same lever for a registered name until its /login.

TogglePlayerControllable(pid, controllable)
Parameter Type
pid number the player
controllable boolean false holds, true releases

boolean - false when not connected

-- freeze everyone for the countdown
for _, pid in ipairs(GetPlayers()) do TogglePlayerControllable(pid, false) end
SetTimer(function()
for _, pid in ipairs(GetPlayers()) do TogglePlayerControllable(pid, true) end
GameTextForAll("Go!", 1500)
end, 3000)

IsPlayerControllable · SetPlayerVirtualWorld · SetPlayerCamera · the Players group of the index