I have two solutions for this, the second one is probably the easiest.
Solution 1:
Something you should note is that the cursor should be changed inside of the playermodule instead of character scripts since the player module controls most of the Core UI (like the moue cursor, the leaderboard, and other important things)
So most likely the issue is that the player module is overriding your player script.
If you do want to change the mouse lock cursor, you can grab the player module by loading the game in studio (hit play), then going into your player and then locating the PlayerScripts which then holds the player module. After you locate it, copy it and paste it into the starter player scripts. The player module is very large and does actually get updated so you would probably need to check every once in a while.
After the player module is pasted, you are going to expand everything until you find the camera lock module (I don’t know if thats the name of the module but it should be something close to that) Inside of the module, there should be the image id’s and there you can change it
Solution 2:
You could probably move the script into ReplicatedFirst since it runs everything as soon as you load in. (playerscripts takes a little longer to load in and the cursor image is most likely a constant which is why it’s full uppercased, more explanation on constants near bottom of post)
The reason why ReplicatedFirst would change anything is because the part that actually sets the image to the DEFAULT_MOUSE_LOCK_CURSOR loads earlier than PlayerScripts
Solution 3 (the most guaranteed but also most time-consuming solution):
You can disable the default cursors by using
local UserInputService = game:GetService("UserInputService")
UserInputService.MouseIconEnabled = false
After you disable the cursor, you will need to make a GUI with your custom cursors (you can use the default cursor image for the default cursor) and then you would have to make code that swaps to the shift lock cursor whenever the mouse is locked
--put this in a Screen UI that has an imagelabel that follows the mouse
local UserInputService = game:GetService("UserInputService")
if UserInputService.MouseBehavior == Enum.MouseBehavior.LockCenter then
--Switch to other image (via seperate imagelabels or setting the image property)
else
--Switch to default cursor
end
This code is assuming that you have decent enough roblox studio knowledge and know a little about scripting
Support:
If you need additional help with any of these, feel free to reply to this message.
Constants:
Constants are variables that never change after they are defined.
You can recognize constants by seeing a variable that is fully uppercased like so:
Local CONSTANT_VARIABLE = 75
In roblox, constants can be changed but it’s not recommended because they are most likely used once and aren’t usually checked after their single use which explains why you couldn’t set the cursor.
Hope this helps