Mouse Icon, help!

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
	return false

local prevTarget = nil

	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

Roblox Studio:

In Game:


I don’t see something wrong. It’s fine?
Do you mean you want to replace the mouse with a pickaxe Icon or just keep Booth?

1 Like

Watch both of the gifs, and tell me if you see a difference.

1 Like

Yeah, I see in the Roblox studio the Default Mouse and Pickaxe, but in the game only the Pickaxe icon?

1 Like

Yeah, I don’t understand why it doesn’t work in the game :confused:

Do you want the mouse Icon to be visible in the game with the pickaxe too?

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.

Try UserInputService instead of Player:GetMouse()

Nah, GetMouse is better!
because the input service is only for keyboards

I tried and it still doesn’t work…

I don’t know why tho because if it works in Roblox Studio it should work in a game either!

Did you got any errors in the output in-game?

I changed mouse.Icon = "" in elseif and it worked!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.