Hello, I’m having a problem with mouse icon IN GAME. When I tested it in Roblox Studio everything seemed working, but when I hopped into the game to test it it didn’t work. Anyone knows how to fix it?
local collectionService = game:GetService("CollectionService")
local TS = game:GetService("TweenService")
local player = game:GetService("Players").LocalPlayer
local mouse = player:GetMouse()
local function mouseTarget()
if mouse.Target == nil then return end
if mouse.Target:IsA("MeshPart") then
if collectionService:HasTag(mouse.Target.Parent, "Ore") then
return true
end
end
return false
end
local prevTarget = nil
task.spawn(function()
while wait() do
if mouseTarget() and player.Character:FindFirstChildWhichIsA("Tool") then
mouse.Icon = "rbxassetid://14224757773"
mouse.Target.Transparency = 0
prevTarget = mouse.Target
elseif prevTarget then
mouse.Icon = "rbxassetid://1422475793"
prevTarget.Transparency = 1
else continue end
end
end)
In Your script, you are replacing the mouse icon by using mouse.Icon = "rbxassetid://1422475793"
Instead, you can do
local Plr = game:GetService("Players").LocalPlayer
local newPickIcon = --location of the pickaxe image
local PlrMouse = Plr:GetMouse()
newPickIcon.Position = PlrMouse.Position
This will set the position of the pickaxe image to the player’s mouse without replacing it.
Make sure to set the size of the pickaxe icon correctly so it will not be too big.
Oops, I forgot, you can use renderstep so the pickaxe will always teleport to the mouse icon, not only once.