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

Workspace.iBlox.Functions:4: attempt to call field 'MouseEnter' (a userdata value) help?

I have the function in a module:

function module.Button(button, hover)
	button.MouseEnter():Connect(function() hover.Visible = true end)
	button.MouseLeave():Connect(function() hover.Visible = false end)
end

When I call it it doesn't work and outputs:

09:56:21.059 - Workspace.iBlox.Functions:4: attempt to call field 'MouseEnter' (a userdata value)

What am I doing wrong?

1 answer

✓ Accepted answer

You don't need to add () brackets after the event name

Just do it like this:

function module.Button(button, hover)
    button.MouseEnter:Connect(function() hover.Visible = true end)
    button.MouseLeave:Connect(function() hover.Visible = false end)
end

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