Custom Roblox Cursor

Hey, I know I have been asking you guys a lot of scripting questions for this game but this should be the final one before I put the game in beta testing! I am making an old ROBLOX simulator and made a script that gives everybody the old ROBLOX mouse. But whenever the mouse hovers over a button it changes to the new one. How would I make the cursor stay the same when it hovers over a button.

14 Likes

Please do research before reaching out for help here, if you couldn’t, here you go

local Mouse = game.Players.LocalPlayer:GetMouse()
Mouse.Icon = "rbxassetid://696969"
5 Likes
local uis = game.UserInputService
game["Run Service"].RenderStepped:Connect(function()
	uis.MouseIcon = "" -- set to whatever the asset link is
end)
3 Likes

To extend onto this, using :GetMouse() isn’t the best way to do this anymore, as :GetMouse() is deprecated. You can use the UserInputService to do this. It’s a very similar solution, as explained in a lot more detail here:

local UIS = game:GetService("UserInputService")
UIS.MouseIcon = "rbxassetid://696969"
6 Likes

Wow, mouse is deprecated ?? dang i didn’t know thanks for the infomation m8

2 Likes

hes asking for the custom cursor to still be present over a GUI button which I dont think is possible

edit: without doing something technical

3 Likes

I had the same question and I found this I never ended up using it but maybe you can use it and it will help

2 Likes

Wouldn’t setting the MouseIcon overwrite that behaviour? If not, maybe @Corruptonator has the right idea, by updating the mouse icon every render stepped, but to assure it’s updating in the first possible point before the frame renders, it might be better to use BindToRenderStep. Like so:

local RunS = game:GetService("RunService")
local UIS = game:GetService("UserInputService")

RunS:BindToRenderStep("MouseIconUpdater", Enum.RenderPriority.First.Value, function(step)
    UIS.MouseIcon = "rbxassetid://696969"
end)

This way, we can guarantee that before anything else happens before the frame renders, that mouse icon is updated first. The only way I see this not working is if the mouse icon update happens later, which I have a funny feeling it does.

1 Like

ill test it out but im pretty sure roblox doesnt actively change the icon of the mouse when you hover over a gui button, they just dont display the custom cursor

1 Like

If not, it’s a bit hacky for sure, but could he not set a GUI frame that updates to the mouses position upon an UserInputService InputChanged event on MouseMovement? And set it’s Z-Index to be above everything else, toggling the ‘Visible’ property of the frame to be false every time the user hovers over any other GUI?

2 Likes

yeah thats exactly what the post i linked above suggested except they suggested using an ImageLabel instead. I’m not too sure why they don’t just allow you to customise the cursor hovering over a button though

1 Like

Oh, I didn’t read that haha. If that’s the case then that post should help the OP for sure, they definitely should, they already allow the changing of the cursor icon with ClickDetectors CursorIcon property.

2 Likes

yeah i hope it will, and about the cursor icon, i meant specifically GUI buttons

2 Likes

What I don’t understand is that the game RetroStudio has it so when you hover over a button it still shows that old cursor.

1 Like

they may have done what the post i linked did, have you tried it out yet?

2 Likes

What one? You sent like 3 links lol

1 Like

no ive only sent 1 which was this post:

1 Like

just use a click detect script in your Gui button and a click detector with cursor id in a physical button

1 Like