local player = game:GetService("Players").LocalPlayer local hum = game.Players.LocalPlayer.Character:WaitForChild("Humanoid") local WS = 16 local SB = 21 local Input = game:GetService("UserInputService") local SprintW = tick() Input.InputBegan:connect(function(Run) if Run.KeyCode == Enum.KeyCode.W then local Hit = tick() local TimeBetween = (SprintW - Hit) if TimeBetween <= 0.2 then hum.WalkSpeed = 21 end end end)
I followed some things i found online about tick and such and i really thought that this was gonna work but for some reason it feels like every script i make just doesn't work even when i get no errors did i do something wrong here? The local script is in StarterGui
The value of SprintW is never changed, Set it to the value returned by tick() if TimeBetween is greater than 0.2
local player = game:GetService("Players").LocalPlayer local hum = game.Players.LocalPlayer.Character:WaitForChild("Humanoid") local WS = 16 local SB = 21 local Input = game:GetService("UserInputService") local SprintW = tick() Input.InputBegan:connect(function(Run) if Run.KeyCode == Enum.KeyCode.W then local Hit = tick() local TimeBetween = (SprintW - Hit) if TimeBetween <= 0.2 then hum.WalkSpeed = 21 else SprintW = tick() end end end)