So, I was testing my game, and I created a function that when you equipped the gun, a custom cursor would appear. However, there’s an error. Here are some pictures. Please advise and fix.
You can’t use :GetMouse() on the server.
do u mean i have to use it on a local script instead?
Yes, you can use :GetMouse() on the client, and then use Mouse.Icon to change the icon.
ok thanks so much! you helped me fix it
Because Getmouse() is not works on server.
You should do this in a local script:
local mouse = game.Players.LocalPlayer:GetMouse()
You will see its works.
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local tool = script.Parent
tool.Equipped:Connect(function()
mouse.Icon = "rbxassetid://" --equip icon here
end)
tool.Unequipped:Connect(function()
mouse.Icon = "rbxassetid://" --reset back to default here
end)
Because this will need to be a local script you should do it like in the above.