Hello I was wondering if anyone can help me fix this problem where if I hover my cursor over a button with an already applied custom cursor it wont show while hovering over the button here is my code
local mouse = game.Players.LocalPlayer:GetMouse()
mouse.Icon = 'http://www.roblox.com/asset/?id=172802980'
I had the same problem too. I easily solved by making the cursor invisible and creating an ImageLabel (let’s call it X), then through RunService.RenderStepped, kept setting the position of X to the mouse’s position. To get the position of the mouse on the screen, you can use UserInputService:GetMouseLocation().
-- a local script always has the local player, basically the client.
-- it's getting the local player, and then their mouse.
local mouse = game.Players.LocalPlayer:GetMouse()
-- MouseEnter is basically when the player starts hovering over the object
-- we want the code to run when the player hovers over the button
script.Parent.MouseEnter:Connect(function()
-- set their mouse
mouse.Icon = "YourId"
end)
since when you hover over a button it sets your mouse to something, we make it change back to the thing you want.
So ive tried this and this is my code my problem being idk how to fix the offset because its hugely offset from the mouse
local uis = game:GetService('UserInputService')
local id = "rbxassetid://73737626"
uis.MouseIconEnabled = true
local image = script.Parent
local runService = game:GetService('RunService')
function renderStepped()
local mouseLocation = uis:GetMouseLocation()
image.Position = UDim2.new(0, mouseLocation.X,0, mouseLocation.Y)
end
runService.RenderStepped:Connect(renderStepped)
(Sorry for the bump)
I’ve made some changes to your script. It now works perfectly as intended and it’s cleaner.
local UIS = game:GetService('UserInputService')
local RS = game:GetService('RunService')
function renderStepped()
local mouseLocation = UIS:GetMouseLocation()
image.Position = UDim2.new(0, mouseLocation.X,-0.05, mouseLocation.Y)
end
RS.RenderStepped:Connect(renderStepped)
UIS.MouseIconEnabled = false
local UIS = game:GetService('UserInputService')
local RS = game:GetService('RunService')
local image = script.Parent
function renderStepped()
local mouseLocation = UIS:GetMouseLocation()
image.Position = UDim2.new(0, mouseLocation.X,-0.05, mouseLocation.Y)
end
RS.RenderStepped:Connect(renderStepped)
UIS.MouseIconEnabled = false