Change the speed of all players

In that case change everyone’s walk speed AND connect the CharacterAdded event. To then stop the increased walkspeed simply disconnect the event.

1 Like

You could also add a value to the player object and check it if it = true then you can give them walkspeed back.

You can use a boolvalue:

while true do
      wait()
     if game.ReplicatedStorage.Speed.Value == true then
     for i,v in pairs(game.Players:GetChildren()) do
           v.Character:WaitForChild("Humanoid").WalkSpeed = 50
     end
end
end

Can I know how your buying script works? These suggestions are useful, but I want to be sure on how your buying system is.

1 Like

I’ve found the solution, you don’t have to help me anymore! I just added one: NumberValue

1 Like

I would not recommend that you use a while wait()/true do loop you can find more here.

If you really want a loop, use the Heartbeat event from the RunService, however this is not very performant, setting the walk speed every frame when you don’t need to.

All the OP needs to do is when the player buys the powerup is loop through all of the players changing their walk speed and connecting the character added event to a function that also increases the walk speed.

1 Like