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

Why isn't this brick turning invisible?

I have a script. When you click it (yes i do have a click detector), it is supposed to turn invisible. Pretty simple script, but it isn't working

here is the script

function click()
	wait(0.5)
	script.Parent.Transparency = 1
end

script.Parent.MouseButton1Down:connect(click)

Thank you

2 answers

✓ Accepted answer

Your problem is the fact that you're using the wrong event.

MouseButton1Down is used for GUIs. However, you want to make a Part clickable, so you need a different event.

What you're looking for is the MouseClick event of ClickDetectors.

Remember, a Part itself has no events to record mouse input. Parts are entirely dependent on their ClickDetectors.

function click()
	script.Parent.Transparency = 1
end

script.Parent.ClickDetector.MouseClick:connect(click)

1 comment

0

Thank you, I am used to doing GUI's

If you're putting the script in the part, you're trying to bind the click event to the part.

script.Parent.ClickDetector.MouseButton1Down:connect(click)

If you're putting the script in the detector, you're trying to make the detector transparent.

script.Parent.Parent.Transparency = 1

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