Can't change CursorIcon with script

So I made a bunch of cursors for my game, and tried setting the ClickDetector’s CursorIcon with a script, but it just doesnt work.

To replicate, make a Part, put a ClickDetector inside it, and put this script inside the ClickDetector:

wait(5)
script.Parent.CursorIcon = "rbxassetid://2287179355"

The even weirder thing is that if you remove the wait(5) then the Cursor DOES get changed, but I dont want to change the CursorIcon instantly

I have no idea why this doesn’t want to work
Can someone help?

If you only want the cursor icon to change after a period of time since the mouse has been over the click detector, you’d have two options.

  1. You could connect to the MouseHoverEnter event, wait 5, and then change the cursor.
  2. You could simply use the Player:GetMouse().Icon to change the mouse whenever you want-- this could still be connected to the mousehoverenter event.

Both of these should be run locally, though, because you don’t want to change properties of a click detector for everyone simply based on one person doing something.

1 Like

Oh I just realised that you can ONLY change the CursorIcon with a LocalScript. I wonder why though…

1 Like

Because a local script runs only on the client which is the certain player. A Server Script (regular script) runs on the entire server.

Yes I know that, but ClickDetectors CAN be used on the server, which is exactly what Im doing, and exactly the reason I made this post