Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

After a public countdown, how do I make everyone change team then die?

Asked by 7 years ago
Edited 7 years ago

I got some code already, but I see some errors and don't know why. For my 30 sec countdown, when it reaches zero I want all the players to change to red colored team then die. For my 2 min countdown, when it reaches zero I want them to change to blue colored team then die. I did this, but it does not really work. Can you please help my script and tell me if I put it in workspace or where? And tell me if its a local script or script? I get really confused. Thank you!



local seconds = 120 -- 120 seconds, meaning 2 minutes. local seconds2 = 30 -- My 30 sec one local timer = script.Parent -- Timer object! seconds = ((seconds > 1 and seconds) or 1) function startTimer() local begin = tick() while tick() < begin + seconds do local diff = (math.floor(tick()) - (begin + seconds)) timer.Text = math.floor(seconds / 60) .. ":" .. (seconds % 60) wait(0.1) end for k,v in pairs(game:service("Players"):GetPlayers()) do if v.Character and v.Character:FindFirstChild("Humanoid") then v.Character:FindFirstChild("Humanoid").Health = 0 end end function startTimer2() local begin = tick() while tick() < begin + seconds do local diff = (math.floor(tick()) - (begin + seconds)) timer.Text = math.floor(seconds2 / 60) .. ":" .. (seconds2 % 60) wait(0.1) end for k,v in pairs(game:service("Players"):GetPlayers()) do if v.Character and v.Character:FindFirstChild("Humanoid") then v.Character:FindFirstChild("Humanoid").Health = 0 end end while true do startTimer() startTimer2() end
0
#Don'tUseFreeModels hiimgoodpack 2009 — 7y
0
She might be using free models to learn scripting. awfulszn 394 — 7y
0
Your seconds2 variable is likely treating 2 as a value rather than part of the name, change it to something like Seconds or SECONDS. Do the same for everything with 2 that you made. Viking359 161 — 7y
0
Free models are bad if you don't examine code. They could be logging all your game's hierarchy to tell how you built it, and be messing with DataStores. hiimgoodpack 2009 — 7y
0
That's why they don't auto update :P. Don't want them to update it to a studio virus. H4X0MSYT 536 — 7y

Answer this question