Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Sprint Button Thingy

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

✓ Accepted answer

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)

1 comment

0

Mouse is deprecated if you happen to bump on this question

This discussion is preserved as it was. New answers, comments, and votes are closed.