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

Help with function onClick?

Asked by
Qorm 100
10 years ago

It won't print "hi", or anything else I tell it to do. Code:

1button=script.Parent.Framebase.go
2 
3function onClick()
4    print("hi")
5    end
6 
7button.MouseButton1Down:connect(onClick)

button properties: http://gyazo.com/59330a65a57a533cb5315b68176f10ae I've been trying to figure this out for a while now.. Can't seem to figure it out though. Help would be appreciated!

2 answers

Log in to vote
1
Answered by 10 years ago

Try this:

1local button = script.Parent.Framebase.go
2 
3button.MouseButton1Click:connect(function()
4    print("Put your code here!!!")
5end)

That should work; your properties seem fine.

Ad
Log in to vote
0
Answered by 10 years ago

You gotta define the Mouse so put this at the top

1local character = game.Workspace.Player
2local player = game.Players:GetPlayerFromCharacter(character)
3local mouse = player:GetMouse()

then you got it working.

Answer this question