Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Could someone identify what is wrong with this player speed code?

Asked by 7 years ago

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 ``

1
Use the god damn code block. farrizbb 465 — 7y
0
I cannot understand the code properly as it hasn't been put in a code block. ZetaReticuli 38 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

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".

0
There may be other issues with your script as well. IfIWasntSoSwag 98 — 7y
0
This also needs to be in a LocalScript. Wilbob30 69 — 7y
Ad

Answer this question