I need the buttons to fire when the player’s mouse goes over them. I tried using:
button.InputBegan:Connect(function()
if mouse.MouseButton1Down then
--Code here
end
end)
but It doesn’t update whether the mousebutton one is down or not when its over a gui button. I think its a similar thing to using gameprocessed in User Input Service, but I just cannot think of anyway to fix it, or any other workarounds. Please help
Like @Scottifly said, you can use MouseEnter and MouseLeave. These are generally used to make hover effects, too.
local function onMouseEnter()
print("Mouse entered.")
end
local function onMouseLeave()
print("Mouse left.")
end
button.MouseEnter:Connect(onMouseEnter)
button.MouseLeave:Connect(onMouseLeave)