So this code is meant to stop the player moving by pressing g and after 5 seconds return the players speed. ``
function Remove() game.Workspace.Player1.Humanoid.WalkSpeed = 1 end
function Go() game.Workspace.Player1.Humanoid.WalkSpeed = 16 end
function time() remove() wait(5) Go() end local function onKeyDown( key ) print("g", key, " time:", string.byte(key)) end ``
Did you identify the player correctly? I'm not sure, It looks like you didn't really tell the script where the player is.
local Player = game.Players.LocalPlayer --This grabs the player that clicks or performs the function.
If this helped or whatever, Please, Accept my answer by clicking "Accept Answer".