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

Why when I click on a part, I get an error?

I got an error in the output saying that "MouseButton1Click is not a valid member of ClickDetector "Workspace.RiotAlarm.ClickDetector" Even if the model has a Click Detector.

Also the Script.

local alarm = game.Workspace.AlarmBO

script.Parent.ClickDetector.MouseButton1Click:Connect(function() alarm.Light.SpotLight.Enabled = true alarm.Light.SpotLight2.Enabled = true end)

Image Link -> https://gyazo.com/228276f20aa444ac2365ba8659ca0a50

Please help

1 answer

✓ Accepted answer

It's called OnMouseClick. The one you used, MouseButton1Click is for GUIs. That should just be it :)

1 comment

0

Alright, thanks

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