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

how can i change default walkspeed?

Asked by 5 years ago

is there a way to set the default walkspeed because i cant find anything and ive tried to script it but that only failed, because once the player died the speed reset(i had made a script that increases the speed but that speed gets reset on death) tested to disable the script after it runs once but that didnt work either so idk what to do

if game.Players.PlayerAdded then

game:GetService("Players")

game.Players.LocalPlayer.Character:WaitForChild("Humanoid")

game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 0

end



script.Disabled = true

3 answers

Log in to vote
0
Answered by 5 years ago

There is a much easier way to change the default WalkSpeed that requires no code. To do this you must insert a Humanoid into StarterPlayer and set the WalkSpeed to whatever you like. Upon playing, the Humanoid in StarterPlayer will replace the default Humanoid.

0
truly worked thanks Gameplayer365247v2 1055 — 5y
Ad
Log in to vote
0
Answered by
Divistern 127
5 years ago
Edited 5 years ago

Hey there, there is actually a way to change the speed even if the user has respawned, it'll be showed in the following code;

Code: game.Players.PlayerAdded:Connect(function(plr) plr.CharacterAdded:Connect(function(char) local hum = char.Humanoid hum.WalkSpeed = 0 end) end) Doesn't matter if it was in a Script or a LocalScript since it's speed but in this kind of scenario you will have to use Scripts. Hope this helped.

0
is it supposed to be in the startergui? Gameplayer365247v2 1055 — 5y
0
Definitely not. DeceptiveCaster 3761 — 5y
0
Also, it does matter. Walk speed changed on the client will not be saved to the server. Changing the walk speed must be done on the server if you want it to save. DeceptiveCaster 3761 — 5y
0
i put the script in workspace and serverstorage as a local script and it still didnt work, i still get 16 walkspeed at default Gameplayer365247v2 1055 — 5y
Log in to vote
0
Answered by 5 years ago

Hello! I'm BlackOrange3343 and I'll be helping you today.

Let's restart.

  1. Insert a Script into StarterCharacterScripts (StarterCharacterScripts is located in StarterPlayer)

StarterCharacterScripts is a place where each time the character is spawned, the script is cloned into the character and will run once. It automatically resets everytime you die.

  1. Now define the character and any variables you may need
local Char = script.Parent -- this is because the script is cloned into the character
local Humanoid = Char:WaitForChild('Humanoid')
  1. Now Add the changing line
local Char = script.Parent -- this is because the script is cloned into the character
local Humanoid = Char:WaitForChild('Humanoid')
Humanoid.WalkSpeed = 0

And you're done!

Best of luck developer! Hope this helped.

BlackOrange3343

PS: Always learn the basics before making a game or failure will strike multiple times until the scripter gives up or fully restarts and learns the basics.

0
the thing is with this script, whenever i die i will loose the walkspeed ive worked up Gameplayer365247v2 1055 — 5y
0
You can set the walkspeed via CharacterAdded so that every time the Character respawns it will have the assigned walk speed. DeceptiveCaster 3761 — 5y

Answer this question