Still have questions? Join our Discord server and get real time help.
Log in to vote

How do I make this script work for every1 at the same time?

Asked by 2 years ago
Edited 2 years ago

so this script is a countdown gui. i forgot how to make it so it works for everyone at the same time. for instance, if someone joins and it begins counting down from 45, when the next person joins it should not start at 45 again, it should be whatever number the first person who joined is.

while true do local time = 45 for i = 1, 45 do wait(1) time = time - 1 script.Parent.Text = tostring(time) end script.Parent.Parent.Parent.Parent.Character.Humanoid.Health = 100 end

It messed up the code ugh. that should be 9 lines not 3 lol. yodaxvader 0 — 2y

1 answer

Log in to vote
Answered by
Denny9876 1399 Moderation Voter
2 years ago

You could do this server-side with a server (regular) script. Then when the countdown ends, you can use a for loop to get every player and put their health to 100.

The loop would be something like this :

for i,plr in pairs(game.Players:GetPlayers()) do
plr.Character.Humanoid.Health = 100

Typed this on mobile so sorry if it looks weird. :P


Answer this question