Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 3 years ago

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

Log in to vote
0
Answered by 3 years ago

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

0
Alright, thanks OmqFroko 7 — 3y
Ad

Answer this question