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

Help with function onClick?

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

✓ Accepted answer

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.

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.

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