How would I increase the “speed” leaderstats of each player by 1 every single second? I think while loops are viable methods but also know they are to be avoided at all times due to performance issues. I know RunService has a HeartBeat method but it runs way too quickly. I need the leaderstats to go up by 1 every second, not every frame. Ideas?
your “Very simple script” wouldn’t even work since it doesn’t create the leaderstats and speed value
when you say while loops should be avoided, i agree but that’s only when you’re looping through heavy code fast
a simple 1 second increment isn’t going to hurt
game.Players.PlayerAdded:Connect(function(Player)
local Leaderstats = Instance.new("Folder", Player); Leaderstats.Name = "leaderstats"
local Speed = Instance.new("NumberValue", Leaderstats); Speed.Name = "Speed"
while wait(1) do
Speed.Value += 1
end
end)