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

How do i make a part disappear and become untouchable for 5 seconds?

I am making a Spleef-like game, and I am having difficulties with the pieces i need to disappear. Specifically, i have been trying to make a brick go invisible and untouchable, effectively making it disappear, for 5 seconds, then reappear. But once a player touches it, he needs just enough time to run away, so he does not instantly fall. Help?

2 answers

Hi...(I cant test this right now but it should work) you would need to use the transparency and cancollide property's. This isnt really a request site either but

part = script.Parent--this is making a variable part is the scripts parent so make sure the script is in the part.

function invisible()-- this is making a function so we can make this script.
	part.Transparency = 1 -- So we made the transparency invisible
	part.CanCollide = false-- and where u can walk through it
	wait(5)--were waiting 5 seconds then
	part.Transparency = 0 -- Its visible
	part.CanCollide = true --You cant walk through this
end --end
invisible() --we are calling our function

Like I said I cant test this right now but it should work. Hope this helped let me know if it did.

Place this script in the part, along with a ClickFunction:

function turnInvisible(part)
	part.Transparency = 0
	wait(1) --We have now waited 1 second
	part.Transparency = 0.2
	wait(1) --We have now waited 2 seconds
	part.Transparency = 0.4
	wait(1) --We have now waited 3 seconds
	part.Transparency = 0.6
	wait(1) --We have now waited 4 seconds
	part.Transparency = 0.8
	wait(1) --We have now waited 5 seconds
	part.Transparency = 1
	part.CanCollide = false
end
script.Parent.ClickDetector.MouseClick:connect(turnInvisible(script.Parent))

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