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

Can someone please explain why "MouseButton1Click" isn't an option for an event in my script?

Code is located in a localscript / local ItemButton = script.Parent.ItemsButton

ItemButton.MouseButton1Click:connect(function() print "worked" end) / If I could also get be told how to resolve this I'd appreciate it.

enter image description here

1 answer

✓ Accepted answer

If the script is inside of the button then just use script.Parent instead of script.Parent.ItemsButton. Also check for any spelling mistakes.

local ItemButton = script.Parent

ItemButton.MouseButton1Click:Connect(function(check)
print("It worked!")
end)

Try putting this script inside the button.

6 comments

0

This didn't fix it, I noticed that the issue is the "MouseButton1Click". Basically when I start typing "Mouse" after "ItemButton." it'll give different options of what can be typed, and "MouseButton1Click" isn't one of them. That's kind of the issue here, don't have a clue on how to resolve it though.

0

Can you screenshot the list of options?

0

are u sure ur button is a TextButton?

0

and try print("It worked")

0

I changed the button that will get clicked to a text button, and it works now. Didn't know that for "MouseButton1Click" to work it requires a textbutton, good to know. Thankyou for telling me, appreciate the help!

0

please, UpVote my comment if I helped.

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