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

MouseButton1Down Doesn't Work?

Asked by 9 years ago

I am fairly new to scripting and I got this script from off of the ROBLOX wiki and I wanted to just see if it worked so I just made it print something. All the script does is when the player clicks the TextButton in the SurfaceGui it prints something to output but it doesn't do any of that...

local textButton = script.Parent

textButton.MouseButton1Down:connect(function()
    print("Clickity")
end)

2 answers

Log in to vote
1
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
9 years ago

Make sure it's a localscript, and that the gui is in StarterGui

0
The script is a local script, and the thing is the gui is a SurfaceGui it won't work in StarterGui. ChildOfGiotto 5 — 9y
0
Actually it's supposed to be in StarterGui. Even if it's a SurfaceGui.. as long as the Adornee is defined it will show up. Goulstem 8144 — 9y
0
Hey cool thanks! I never thought about it that way. ChildOfGiotto 5 — 9y
Ad
Log in to vote
0
Answered by 9 years ago

Why don't you just add a ClickDetector and use that?

Answer this question