I worked on a speed script and this is what I got:
01 | repeat wait() until game.Players.LocalPlayer |
02 | player = game.Players.LocalPlayer |
03 |
04 | repeat wait() until player.Character |
05 | character = player.Character |
06 |
07 | repeat wait() until character:FindFirstChild( "Humanoid" ) |
08 | humanoid = character.Humanoid |
09 |
10 | humanoid.WalkSpeed = 25 |
It keeps the speed at 16 instead of 25. I tested this to be sure I didn't just suck at telling what the speed is by setting it at 150, but that stayed at 16 too.
Any suggestions? Thanks.
Hi, Instead of doing this, you should use the function PlayerAdded. What this does is fires your code when a player joins. So your code would look like:
1 | game.Players.PlayerAdded:connect( function (player) --Define the player |
2 | repeat wait() until player |
3 | local humanoid = player.Character:FindFirstChild( "Humanoid" ) |
4 | if humanoid and humanoid.Health > 0 then --Check if there is a humanoid and they're alive |
5 | humanoid.WalkSpeed = 25 |
6 | end |
7 | end ) |
PlayerAdded function will not work in a local script! Hope this helped!
Problem
Im not really sure on this one but simply doing character.humanoid instead of doing through the local made it work.
Solution
01 | repeat wait() until game.Players.LocalPlayer |
02 | player = game.Players.LocalPlayer |
03 |
04 | repeat wait() until player.Character |
05 | character = player.Character |
06 |
07 | repeat wait() until character:FindFirstChild( "Humanoid" ) |
08 | humanoid = character.Humanoid |
09 |
10 | character.Humanoid.WalkSpeed = 25 -- set walkspeed |
Hope this helps