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

How to kill the player once the timer reaches a certain limit?

Asked by 4 years ago
Edited 4 years ago

Hey there! I'm trying to figure out how to make the player have health on 0 (therefore, killing the player) once a timer reaches by, lets say, 10 minutes. I couldn't figure this out.

if mins >= 10 and seconds >= 0 then hum.Health = 0

This however doesn't work. Usually my time is around 0 to start. but the script sets the time to 10:00, Immediately killing the player once they spawn.

01local mins = 9
02local seconds = 40
03 
04repeat
05    if seconds >= 10 then
06        mins = mins + 1
07        seconds = 0
08    else
09        seconds = seconds + 1
10    end
11    if seconds < 10 then
12        script.Parent.Text = tostring(mins)..":0"..tostring(seconds)
13    else
14        script.Parent.Text = tostring(mins)..":"..tostring(seconds)
15    end
View all 22 lines...
0
Add a code block, and indent your code. DinozCreates 1070 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

"if mins is greater than or = 10 and if seconds is greater than or equal to 0" it's greater than. so it's killing the player. Script is just doing what you tell it to do.

Here's operators.

https://developer.roblox.com/en-us/articles/Operators

">= Greater than or equal to
<= Less than or equal to"

0
No, that is not what I meant. I need the time to start the value of the mins and secs back in lines 1 and 2. but instead of the time starting at 9:40 (the value of the first two variables), it starts at 10:00 (this is what I need help with. Whatever value I put in the first variables it will always start at 10:00.), repeatedly killing the player every time they spawn. OriginalPacificalSun 0 — 4y
Ad

Answer this question