When the player touches a brick a GUI timer pops up with 30 seconds.
When the timer runs out the player gets killed and the timer resets back to 30 seconds
I want the timer to pop up when the player actually touches the brick.
Can anyone make up a Lua script for this?
I use the Touched event of a brick to know when it is touched. Then I check to make sure the part that touched it is part of a character. And if they don't have the GUI I give it to them and start the countdown.
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)