local i = 1
repeat print(i.." seconds left!")
i = i + 1
wait(1)
if i == 61 then
local pl = workspace:FindFirstChild("Player")
if pl then
local hum = pl:FindFirstChild("Humanoid")
if hum then
hum.Health = 0
end
end
break end
until
i == 61
Something is wrong with my scripting, help?
1 answer
There is an instant problem with your script. During the repeat, you're just printing 1 constantly.
You need a while loop.
Also, for the game.Players.LocalPlayer to work, you need to put this into a localscript.
Note that it kills the humanoid.
local i = 60
while i > 0 do -- goes through the loop until i is 0.
print(i.." seconds left!")
i = i - 1
end
if i == 0 then
local pl = game.Players.LocalPlayer
local character = pl.Character
if pl then
local hum = pl:WaitForChild("Humanoid") -- Waiting until the humanoid is found.
if hum then
hum.Health = 0
end
end
Note that you should only use break if you're in a while loop.
-- Hydroid18 (Using my alt until I can get help from the SH staff with my account.)
4 comments
the timer doesn't even go off?
fixed the timer part but it still doesn't kill the player
Of course it's not going to work. You didn't really give enough information. Like what it is meant for and where it is located.
It's pretty clear in the script: I just want the timer to go to count up to sixty and then kill the player. My timer worked but the killing part didn't, yet neither of yours worked which is why I unaccepted.
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
What exactly is the problem you're having?
It isn't killing the player, forgot to add that