I'm creating an obby that you have to go fast. I got a solution, but i had my friend try it and it won't work for him. And i can understand why, because this is what i used.
1 | game.Workspace.Roblozinko.Humanoid.WalkSpeed = 75 |
2 | repeat |
3 | game.Workspace.Roblozinko.Humanoid.WalkSpeed = 75 |
4 | wait (. 5 ) |
5 | until 6 = = 5 |
It's because his and my username is different, so it only works for me. and i tried one from another question,
1 | wait ( 5 ) |
2 | repeat |
3 | game.Workspace.Player 1. Humanoid.WalkSpeed = 75 |
4 | wait (. 5 ) |
5 | until 6 = = 5 |
and that didn't work. I got the output, "Player1 is not a valid member of workspace." I also tried it in a localScript and Script. Please help! thanks. :3
Simple and straightforward: Whenever a players' character is added, set their Humanoid's WalkSpeed to 75. This can be accomplished using the CharacterAdded
event of Player instances.
Insert a Script into ServerScriptService:
1 | game.Players.PlayerAdded:Connect( function (plr) |
2 | plr.CharacterAdded:Connect( function (char) -- This will fire every time their player's chararcter gets added |
3 | char:WaitForChild( "Humanoid" ).WalkSpeed = 75 |
4 | end ) |
5 | end ) |
Hope I helped!
Maybe try this method.
1 | local Players = game:GetService( "Players" ) |
2 | for _,Player in pairs (Players:GetPlayers()) do |
3 | local Char = Player.Character or Player.CharacterAdded:Wait() |
4 | if Char then |
5 | Char:WaitForChild( "Humanoid" ).WalkSpeed = 75 |
6 | end |
7 | end ) |
x = 50 --speed boost
for i,v in pairs(game.Players:GetPlayers()) do v.Character.Humanoid.Walkspeed = x end