In that case change everyone’s walk speed AND connect the CharacterAdded event. To then stop the increased walkspeed simply disconnect the event.
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.
I’ve found the solution, you don’t have to help me anymore! I just added one: NumberValue
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.