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:

button=script.Parent.Framebase.go

function onClick()
    print("hi")
    end

button.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:

local button = script.Parent.Framebase.go

button.MouseButton1Click:connect(function()
    print("Put your code here!!!")
end)

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

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

then you got it working.

Answer this question