When the player touches a brick a countdown pops up for 30 seconds. When the countdown ends the player dies and the script ends.
Can anyone help me here? i have been given this script.
function NewGui()
local Gui = Instance.new("ScreenGui")
Gui.Name = "Countdown Gui"
local Tect = Instance.new("TextLabel",Gui)
Text.Name = "Countdown"
Text.Size = UDim2.new(0.3,0,0.3,0) --Adjust size
Text.Position = UDim2.new(0,0,0,0) --Adjust position if wanted.
return Gui
end
script.Parent.Touched:connect(function(Part)
local Player = Game:GetService("Players"):GetPlayerFromCharacter(Part.Parent)
if Player and not Player.PlayerGui:FindFirstChild("Countdown Gui") then
local Gui = NewGui()
Gui.Parent = Player.PlayerGui
for i=30,0,-1 do
Gui.Countdown.Text = i
wait(1)
end
Player.Character:BreakJoints()
end
end)
