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

Sprint Button Thingy

Asked by 11 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 11 years ago

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

01local Player = game.Players.LocalPlayer
02local Mouse = Player:GetMouse()
03local KeysDown = {}
04 
05Mouse.KeyDown:connect(function(Key)
06if Key:lower() == "w" then
07KeysDown["w"] = true   
08elseif Key:byte() == 48 then
09KeysDown["Shift"] = true
10end
11 
12if KeysDown["w"] and KeysDown["Shift"] then
13Player.Character.Humanoid.WalkSpeed = 40
14end
15end)
View all 27 lines...
0
Mouse is deprecated if you happen to bump on this question Tymberlejk 143 — 5y
Ad

Answer this question