this is the script, but the problem is that it is not timed normally, every second 4 appears but one second later 4 3 appears and the next second 4 3 2, but I want it, I hope I have explained it clearly
what changes should i make?
local touchPart = workspace.PlayingZone.Lava
touchPart.Touched:Connect(function(part)
if part.Parent:FindFirstChildWhichIsA("Humanoid") then
local Gui = script.parent
Gui.Visible = true
Gui.Text = "You will die in: 4"
wait(1)
Gui.Text = "You will die in: 3"
wait(1)
Gui.Text = "You will die in: 2"
wait(1)
Gui.Text = "You will die in: 1"
wait(1)
Gui.Visible = false
end
end)
i really dont know whats the issue but try this instead
local touchPart = workspace.PlayingZone.Lava
touchPart.Touched:Connect(function(part)
if part.Parent:FindFirstChildWhichIsA("Humanoid") then
local Gui = script.Parent
Gui.Visible = true
for i = 4, 1, -1 do
Gui.Text = "You will die in: " .. i
task.wait(1)
end
Gui.Visible = false
end
end)
local shouldProcess = true
somePart.Touched:Connect(function(hit)
if shouldProcess == false then return end
shouldProcess = false
-- your code that yields
shouldProcess = true
end)
by the way, I would need a small modification, how do I make that gui stop showing after death? the problem is that I die on that part and after death that script starts working again and closes only after respawn