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

Speed Script Nonfunctioning?

I worked on a speed script and this is what I got:

repeat wait() until game.Players.LocalPlayer
player = game.Players.LocalPlayer

repeat wait() until player.Character
character = player.Character

repeat wait() until character:FindFirstChild("Humanoid")
humanoid = character.Humanoid

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.

2 answers

✓ Accepted answer

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:

game.Players.PlayerAdded:connect(function(player)--Define the player
	repeat wait() until player
	local humanoid = player.Character:FindFirstChild("Humanoid")
	if humanoid and humanoid.Health > 0 then--Check if there is a humanoid and they're alive
		humanoid.WalkSpeed = 25
	end
end)

PlayerAdded function will not work in a local script! Hope this helped!

1 comment

0

Sorry for the late reply but this worked. Thanks, left an accept.

Problem
Im not really sure on this one but simply doing character.humanoid instead of doing through the local made it work.
Solution

repeat wait() until game.Players.LocalPlayer
player = game.Players.LocalPlayer

repeat wait() until player.Character
character = player.Character

repeat wait() until character:FindFirstChild("Humanoid")
humanoid = character.Humanoid

character.Humanoid.WalkSpeed = 25 -- set walkspeed

Hope this helps

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