Hello developers!, i wanted to make a tutorial on how to fix the problem that when you change the mouse Icon using:
mouse.Icon = "rbxassetid//:00000000"
when you hover over a gui button our mouse icon that we stated above changes instantly to default, i have a simple solution to keep this clear and minimal:
First things first we use our chosen cursor and then we just add it with custom size and aswelll as an image label
Second step would be add a local script into the cursor that we have prior to this step as an imagelabel
Third Step
we move on writing some code! Exciting right?
-- state the runservice variable to start the code
local runservice = game:GetService("RunService")
then we add other variable that gets the player mouse so we can disable the default thing
local mouse = game.players.localplayer:GetMouse()
okay so 2 lines of code are going to be crucial with the next line
game:GetService("UserInputService").MouseIconEnabled = false
excellent!, these 3 lines of code will make future on our thing so lets just move ahead and add a simple function to change the mouse and get the mouse position andd replacing the disabled thing with our imagelabel (the imagelabel always has to be visible tho).
runservice.RenderStepped:Connect(function()
script.parent.position = UDim2.new(0,mouse.X,0,mouse.Y)
end)
now having our entire thing it would be something like this:
local RunService = game:GetService("RunService")
local mouse = game.Players.LocalPlayer:GetMouse()
game:GetService("UserInputService").MouseIconEnabled = false
RunService.RenderStepped:Connect(function()
script.Parent.Position = UDim2.new(0,mouse.X,0,mouse.Y)
end)
Remember that the hierarchy of the stuff should be something like:
Alright, i hope this tutorial worked for most of you guys, any problem or stuff make sure to hit my dms and i will be up to helping you guys!, see ya!, if you guys want more tutorials and stuff ill make sure to add them for this epic community!!, Cheers!!
- Karmak/Programmer