Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

2 comments

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.

0

Now it won't kill them...

1 answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.