Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make a brick disappear when touched and reappear at a chosen time?

When a player steps on the brick it disappears then after the selected time passes it becomes visible again.

3 answers

✓ Accepted answer

Try this script

function onTouched(hit)
	script.Parent.Transparency=1 -- Make sure the script is in the part you want to make disappear
	script.Parent.CanCollide = false
	
	wait(5) -- For this example, I will use 5 seconds change 5 to the number of seconds you want to wait
	
	script.Parent.Transparency=0
	script.Parent.CanCollide = true
end
 
script.Parent.Touched:connect(onTouched)

6 comments

0

Im having a similar problem except i need an onclick script. Can you translate this script into onclick instead of ontouch please

0

Earlgrey2014 I have the script I converted can you create a question so I can give the script to you?

0

My part wont disappear can anyone help please?

0

This code worked great for me. I also added wait(1) before setting Transparency to 1. That gives the player a chance to step on the part and keep moving like if they were crossing a bridge-like platform

0

some ppl here doesnt know how to script, they only know to copy and paste

0

the script is in my answer, all u need to do is just change the (onTouch) => (onClick) if u didnt know this, u need to learn how to script instead of copy pasting

Thank you, my blocks are disappearing perfectly fine, but I have a problem specific to my game. The blocks are taking like 5+ seconds to respawn. How do I change that?

2 comments

0

it is taking that long to respawn because it is set at wait 5 seconds which is the wait(5) if you want it to respawn faster just change it.

0

Wow I overlooked that, sorry.

	function onTouched(hit)
	    script.Parent.Transparency=1 -- Make sure the script is in the part you want to make disappear
	    script.Parent.CanCollide = false
 
    wait(5) -- For this example, I will use 5 seconds change 5 to the number of seconds you want to wait
	 
	    script.Parent.Transparency=0
	    script.Parent.CanCollide = true
	end
	 
	script.Parent.Touched:connect(onClick)

This discussion is preserved as it was. New answers, comments, and votes are closed.