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?
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