Typing Version:
local plr = game:GetService("Players").LocalPlayer plr.Chatted:connect(function(msg) msg = msg:lower() if (msg == "afk.on") and (plr.Character.Parent == workspace) then AnimBackup = plr.Character.Animate:Clone() plr.Character.Parent = game:GetService("Lighting") elseif (msg == "afk.off") and (plr.Character.Parent == game:GetService("Lighting")) then plr.Character.Parent = workspace plr.Character:MakeJoints() AnimBackup.Parent = plr.Character end end)
Key Version:
local plr = game:GetService("Players").LocalPlayer local keyToggle = "key goes here" local function onKeyPress(actionName, userInputState, inputObject) if (userInputState == Enum.UserInputState.Begin) and (plr.Character.Parent == workspace) then animBackup = plr.Character.Animate:Clone() plr.Character.Parent = game:GetService("Lighting") elseif (userInputState == Enum.UserInputState.Begin) and (plr.Character.Parent == game:GetService("Lighting")) then plr.Character.Parent = workspace plr.Character:MakeJoints() animBackup.Parent = plr.Character end end game:GetService("ContextActionService"):BindAction("keyPress", onKeyPress, false, Enum.KeyCode[KeyToggle])