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

HOw do I make this timer for everyone in the server?

Asked by 6 years ago

I've been making a script for a timer and I got the basics down. It countdowns and switches team. My problem is it just switches the team and restarts the time how would I fix this?

while true do
    wait(1)
    if script.Parent.Value == 290 then
        script.Parent.Parent.Parent.Parent.Parent.TeamColor = BrickColor.new("Crimson")
        script.Parent.Parent.Parent.Parent.Parent.Character.Humanoid.Health = 0
    else if script.Parent.Value == 0 then
        script.Parent.Parent.Parent.Parent.Parent.TeamColor = BrickColor.new("Medium Stone grey")
        script.Parent.Parent.Parent.Parent.Parent.Character.Humanoid.Health = 0
    else
        script.Parent.Value = script.Parent.Value - 1
        end
    end
end
0
Perhaps a for statement would help for changing the character's health? Or specify "Character" like doing game.Players.LocalPlayer.Name.Humanoid.Health = 0 instead of Character.Humanoid.Health. Santeeisweird9 0 — 6y
0
Now it won't kill them... DarkishPilot -2 — 6y

1 answer

Log in to vote
-1
Answered by
Paldi 109
6 years ago

I think that might be what you're looking for?

while wait(1) do
    if script.Parent.Value == 290 then
        script.Parent.Parent.Parent.Parent.Parent.TeamColor = BrickColor.new("Crimson")
        script.Parent.Parent.Parent.Parent.Parent.Character.Humanoid.Health = 0
    elseif script.Parent.Value == 0 then
        script.Parent.Parent.Parent.Parent.Parent.TeamColor = BrickColor.new("Medium Stone grey")
        script.Parent.Parent.Parent.Parent.Parent.Character.Humanoid.Health = 0
    end
        script.Parent.Value = script.Parent.Value - 1
    end
end
Ad

Answer this question