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

Sprint Button Thingy

Asked by 10 years ago

How do you make it like in games where pressing shift allows the character to move faster? Does it have anything to do with accelerating the moving animation of the humanoid that was my guess but im not sure

1 answer

Log in to vote
1
Answered by 10 years ago

Here is a script for sprint when you press the left shift.


local Player = game.Players.LocalPlayer local Mouse = Player:GetMouse() local KeysDown = {} Mouse.KeyDown:connect(function(Key) if Key:lower() == "w" then KeysDown["w"] = true elseif Key:byte() == 48 then KeysDown["Shift"] = true end if KeysDown["w"] and KeysDown["Shift"] then Player.Character.Humanoid.WalkSpeed = 40 end end) Mouse.KeyUp:connect(function(Key) if Key:lower() == "w" then KeysDown["w"] = false elseif Key:byte() == 48 then KeysDown["Shift"] = false end if not KeysDown["w"] or not KeysDown["Shift"] then Player.Character.Humanoid.WalkSpeed = 16 end end)
0
Mouse is deprecated if you happen to bump on this question Tymberlejk 143 — 4y
Ad

Answer this question