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

My clickdetector script isn't working, and i need help..?

script.Parent.MouseButton1Click:Connect(function() game.workspace.testing.CanCollide = false end)

It's anincredibly simple script. When I click this textbutton, the part that is named testing will become uncollidable.. but it isn't working?? A little help?

If you're wondering, the script's parents is a textbutton, then a frame, then surface gui, then a part, and THEN the workspace.

I'm confused on why it isn't working despite it being so simple

5 comments

0

Since you are working with guis, the SurfaceGui should be in StarterGui, and you can set the Adornee to whatever part t should be adorned to, and make your script a local script because you are handling GUI input

0

are you using an actual clickdetector?

0

I'm mixing things up

0

OP is not using a click detector. But rather a SurfaceGui. Which makes the title misleading.

0

yEP im sorry that the title is kind of misleading,, it isn't a click detector

1 answer

✓ Accepted answer
local button = script.Parent
button.MouseButton1Click:Connect(function()
	workspace.testing.CanCollide = false
end)

This did work for me when I tested it, if it didn't work for you, then I'd suggest looking at the spelling of the part to make sure you don't have any capitalization errors. You might also have had the hierarchy wrong and didn't realize it?

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