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

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

Asked by 6 years ago

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

Log in to vote
0
Answered by
Amiaa16 3227 Moderation Voter Community Moderator
6 years ago

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
Ad

Answer this question