I want to override the cursor for gui elements when you hover over it. I am trying to make a custom hover cursor instead of the default cursor. I’ve tried a couple of events yet none worked. Any help will be appreciated.
You can use
GuiObject.MouseEnter:Connect(function()
In combination with
local Mouse = Player:GetMouse()
Mouse.Icon = YourImageId
as @starnova224 said you can use GuiObject.MouseEnter
for that just make sure you also use GuiObject.MouseLeave
in combination with
local Mouse = Player:GetMouse()
Mouse.Icon = "" --default cursor
so the cursor doesn’t change forever
It doesn’t work as the normal textbutton object hover overrides the current mouse icon.
script.Parent.MouseEnter:Connect(function()
game.Players.LocalPlayer:GetMouse().Icon = "rbxassetid://5970271800" -- custom hover cursor
end)
script.Parent.MouseLeave:Connect(function()
game.Players.LocalPlayer:GetMouse().Icon = "rbxassetid://5972875758" -- custom default cursor
end)
While the cursor hovers over a
GuiButton
, this property is temporarily ignored.
From the Developer Page on Mouse.Icon
So you can’t change the mouse icon to be custom when hovering over a Gui button
1 Like