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

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

Asked by 5 years ago
Edited 5 years ago

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

Log in to vote
1
Answered by 5 years ago

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.

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. DylanD319 9 — 5y
0
Can you screenshot the list of options? develop_d 53 — 5y
0
are u sure ur button is a TextButton? NickAtNick 163 — 5y
0
and try print("It worked") NickAtNick 163 — 5y
View all comments (2 more)
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! DylanD319 9 — 5y
0
please, UpVote my comment if I helped. NickAtNick 163 — 5y
Ad

Answer this question