I made a script with a timer. It works perfectly on a GUI. Nothing is wrong. Its just a timer script that shows the time left on a GUI and when its reaches zero it deletes a platform block. But! I tried a lot of things, how do you bring back that object?
local three = 3 local two = 2 local one = 1 local zero = "Round Over" local twenty = "Begin" local brick = workspace.Part for i = ten, 0, -1 do script.Parent.Text = ten wait (1) script.Parent.Text = nine wait(1) script.Parent.Text = eight wait(1) script.Parent.Text = seven wait(1) script.Parent.Text = six wait(1) script.Parent.Text = five wait(1) script.Parent.Text = four wait(1) script.Parent.Text = three wait(1) script.Parent.Text = two wait(1) script.Parent.Text = one wait(1) script.Parent.Text = zero brick:destroy() wait(5) script.Parent.Text = twenty wait(3) end
If you don't have a copy of the block as backup somewhere, destroying it would leave you with no way to get it back. Here's what I would recommend:
--Alongside the variable for "brick", also define a backup copy of that brick. local brick = workspace.Part --I would really recommend that you use a unique name for the part you want to manipulate with this script, and change this line to reflect it, if you haven't already. local brickBackup = brick:clone()
--When the brick gets destroyed brick:Destroy() wait(5) brick = brickBackup:clone() --Make a new brick from the saved backup brick.Parent = game.Workspace --Put the brick into the game script.Parent.Text = "20"
Woops! This Code. Missed a bit.
local ten = 10 local nine = 9 local eight = 8 local seven = 7 local six = 6 local five = 5 local four = 4 local three = 3 local two = 2 local one = 1 local zero = "Round Over" local twenty = "Begin" local brick = workspace.Part for i = ten, 0, -1 do script.Parent.Text = ten wait (1) script.Parent.Text = nine wait(1) script.Parent.Text = eight wait(1) script.Parent.Text = seven wait(1) script.Parent.Text = six wait(1) script.Parent.Text = five wait(1) script.Parent.Text = four wait(1) script.Parent.Text = three wait(1) script.Parent.Text = two wait(1) script.Parent.Text = one wait(1) script.Parent.Text = zero brick:destroy() wait(5) script.Parent.Text = twenty wait(3) end