This is a very odd problem. All the print()
's are printing, and the WalkSpeed is getting changed the way it's supposed to, 0 when you press /
and 16 when you press Enter
. However, when you press enter your character still behaves as if your WalkSpeed is 0, even though I know it is 16! I know it is 16 because I used the Developer Console to run the code, print(Workspace.Perci1.Humanoid.WalkSpeed)
and it printed 16.
But now it gets even weirder; before I ran that print command, it looked as if my WalkSpeed remained at 0. However, after I ran that code, and it printed '16', my WalkSpeed went back to normal again!
Why would my WalkSpeed get changed to 0, then 16, but still behave as if it was 0? And how come after I used the Developer Console to print something, it behaved normally again?
Here's the LocalScript:
local plr = game.Players.LocalPlayer repeat wait() until plr.Character local chr = plr.Character local mouse = plr:GetMouse() local startCommand = "/" local addToString = false local theString = "" game.StarterGui:SetCoreGuiEnabled("Chat", false) mouse.KeyUp:connect(function(key) if key == startCommand and not addToString then addToString = true chr:WaitForChild("Humanoid").WalkSpeed = 0 print("speed is 0") elseif key:byte() == 13 and addToString then --13 = "Enter" theString = "" addToString = false chr:WaitForChild("Humanoid").WalkSpeed = 16 print("speed is 16") elseif key:byte() ~= 13 and addToString then theString = theString..key end end)
Probably because you press "/" to chat and set the start command to "/" also.