i’m using a custom mouse icon in my game
this is currently my code:
local rs = game:GetService("RunService")
local uis = game:GetService("UserInputService")
local storage = game:GetService("ReplicatedStorage")
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
local dayevent = storage:WaitForChild("dayevent")
local id = "rbxasset://textures/Cursors/KeyboardMouse/ArrowFarCursor.png"
local id2 = "rbxasset://textures/Cursors/KeyboardMouse/ArrowCursor.png"
local normal = "rbxassetid://13902810543"
local far = "rbxassetid://13902812046"
task.defer(function()
mouse.Icon = normal
uis.MouseIcon = normal
end)
uis.Changed:Connect(function(prop)
if prop == "MouseIcon" then
if uis.MouseIcon == id then
mouse.Icon = normal
uis.MouseIcon = normal
elseif uis.MouseIcon == id2 then
mouse.Icon = far
uis.MouseIcon = far
end
end
end)
dayevent.OnClientEvent:Connect(function(mchangecheck, daytime)
if not mchangecheck then return end
if daytime then uis.MouseIconEnabled = true else uis.MouseIconEnabled = false end
end)
--[[
rs.Heartbeat:Connect(function()
if mouse.Icon == id or uis.MouseIcon == id then
mouse.Icon = normal
uis.MouseIcon = normal
elseif mouse.Icon == id2 or uis.MouseIcon == id2 then
mouse.Icon = far
uis.MouseIcon = far
end
end)
]]
yes, both images are image ids not decal ids
the task.defer function works fine, and the mouse icon changes to the image
now here’s my issue:
once i equip a tool which changes the mouse.icon and uis.mouseicon both to the gun icon and then unequip it, it shows the default mouse icon and doesn’t change back unless it’s manually changed
while wait()/task.wait() do loops don’t seem to work, runservice.heartbeat and renderstepped don’t work either
i’m 100% sure there are no scripts changing the mouse icon aside from the tool cursor script, this is the code for it:
local storage = game:GetService("ReplicatedStorage")
local uis = game:GetService("UserInputService")
local cursors = storage:WaitForChild("cursors")
local icon = cursors:WaitForChild("gun").Value
local iconr = cursors:WaitForChild("gunreload").Value
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
local char = plr.Character or plr.CharacterAdded:Wait()
local tool = script.Parent
local cursor = nil
local function update()
if cursor and tool.Parent == char then
cursor.Icon = tool.Enabled and icon or iconr
else
mouse.Icon = "rbxassetid://13902810543"
uis.MouseIcon = "rbxassetid://13902810543"
end
end
local function equip(m)
cursor = m
update()
end
local function change(property)
if property == "Enabled" then
update()
end
end
tool.Equipped:Connect(equip)
tool.Unequipped:Connect(equip)
tool.Changed:Connect(change)
yah the code is a rewritten version of the old tool cursor lol
i’m not sure if i explained my situation well enough, so please let me know if you need more information