You can use this shift to sprint script to make players run in your games with a really easy accessible key of “Shift”. In this case you can change how the script works, change the key they press to sprint or to change how much FOV changes when running. Or even if you don’t want the script to change the players.
How it works
This script works being in the StarterPlayerScripts area then can be used to make a player walk faster than the normal speed they go at. Eg. When a player presses “Shift” it will make them go fast like as if they are running, also it makes the FOV larger to show how much the speed feels like if you went that fast in real life.
Mobile Support Version (Tablets, iPads and Mobile Phones etc)
SpeedScriptRunner now has mobile support to allow mobile devices such as tablets, ipads and mobile phones to be able to sprint using this script. The mobile version allows the user to toggle between sprinting and walking speeds by using a button. I have tested it number of times to ensure that it understands the difference between mobile devices and desktop/laptop devices. Currently, Xbox controllers are not compatible but hoping to add them soon.
I never thought of shift Lock, I guess when people use shift lock it might not work. Thanks for the feedback by the way.
Maybe I could make it so it ignores the shift lock or checks if you have shift lock on.
Thanks I never thought about the shift lock.
Its easy to change, you can change it to any key you like, by doing
Enum.KeyCode.LeftControl
Some times I use “Q” because its near the “W” to move and it does not mess up with the shift lock thing; but then that would be the same if you changed it to anything but the “LeftShift” Key.
Fistly you need to make this script (in workspace)
Code 1
function onPlayerEntered(player)
repeat wait () until player.Character ~= nil
local s = script.SprintScript:clone()
s.Parent = player.Character
s.Disabled = false
player.CharacterAdded:connect(function (char)
local s = script.SprintScript:clone()
s.Parent = char
s.Disabled = false
end)
end
game.Players.PlayerAdded:connect(onPlayerEntered)
Then you need put into that code this code
Code 2
local mouse = game.Players.LocalPlayer:GetMouse()
local running = false
function getTool()
for _, kid in ipairs(script.Parent:GetChildren()) do
if kid.className == “Tool” then return kid end
end
return nil
end
mouse.KeyDown:connect(function (key) – Run function
key = string.lower(key)
if string.byte(key) == 48 then
running = true
local keyConnection = mouse.KeyUp:connect(function (key)
if string.byte(key) == 48 then
running = false
end
end)
for i = 1,5 do
game.Workspace.CurrentCamera.FieldOfView = (70+(i2))
wait()
end
game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 40
repeat wait () until running == false
keyConnection:disconnect()
game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 16
for i = 1,5 do
game.Workspace.CurrentCamera.FieldOfView = (80-(i2))
wait()
end
end
end)
Thats great but it’s not really simple and easy to read from, but it can be perfectly put in a good layout like mine but does the same check. I am guessing the;
function getTool()
for _, kid in ipairs(script.Parent:GetChildren()) do
if kid.className == “Tool” then return kid end
end
return nil
end
is checking that is not in shift lock, or am I wrong?
Awesome resource and cool discussion on scripting! Overall the script is real well organized and made. Great job on that!
Its cool how other people are also adding onto it to work with certain scenarios.
@msami7893 If you’re planning on adding the limitation for group ranks, heres a tip on security because the script operates only locally, and attackers do have the power to manipulate the behavior of local scripts.
You might want to have server involvement, especially if using with a gamepass. A model would look something like a server script checking players credentials when they join and duplicating the script into their playerScripts storage if they have access. Then its a good practice to have the server verify anything that player performs or communicates to the server as a double check.
Of course its a speed script and not entirely necessary, but I think you’ll find understanding client-server models useful especially learning scripting and scripting securely. Best of luck!
Hello,
Maybe for more security make it load from a server script and then make it local after the player loaded, or even keeping the script server all times.
All you need is to get the character from the player and you are ready to go. I might make it a server script in some time to show how it would work.
I’m thinking gamepass not rank, but I’m not really bothered if exploiters can speed as most exploit programs already have features to speed a character from what I understand.
I don’t know how to script all of that so I might have to hire someone or really try hard to learn. Thank you for the instructions though.
Hello, I see you want mobile support. Sadly, I created this ages ago and I do not believe I want to improve on it anymore. What I would do is create a button which handles while someone is holding it / clicked it it will make the player sprint. However, for now I will not be updating this code.