This is my script that changes the mouse cursor icon:
mouse.Icon = "rbxassetid://166736756"
The problem is, it doesn't change the mouse icon. Do anyone knows how to change the cursor icon correctly?
It's a localscript, so yeah.
Here's my full script:
--[[ Made by TheRobloxPlayer2509 Private gun script --]] repeat wait() until script.Parent.Parent.Parent:IsA("Player") or script.Parent.Parent.Parent:IsA("Model") --Defines local tool = script.Parent local config = tool.Configuration local clip = config.ClipSize local unlimited = config.Unlimited local reserve = config.Remain local remote = tool:WaitForChild("RemoteEvent") local plr = game.Players.LocalPlayer local mouse = plr:GetMouse() local gungui = script.GunGui local aimgui = script.AimGui local anim = {} -- A table that holds all animations --Variables local ammo = clip.Value local debounce = true local cooldown = 0.15 -- In second local equipped = false local range = 300 -- By stud local holding = false local spread = 5 -- Better keep this low, the spread will be higher depends on the distance local aiming = false -- If it's aiming, the spread will decrease by half local aimFOV = 50 -- The field of view when aiming, default is 70 local currentspread = spread -- ignore this --Advanced Settings local ignoreWater = true -- Makes bullet shoot through water local gridifyTerrainCells = false -- Just make this false --Functions local function decode(kind, code) if kind == "byte" then local success, msg = pcall(function() string.byte(code) end) if not success then warn(msg) return nil end if success then return string.byte(code) end end end local function aim() local cam = game.Workspace.CurrentCamera cam.FieldOfView = 70 game.Players.LocalPlayer.CameraMode = Enum.CameraMode.LockFirstPerson local minusFOV = 70 - aimFOV aimgui.Parent = plr.PlayerGui for i,v in pairs(tool:GetChildren()) do if v.Name ~= "Fire" then if v:IsA("UnionOperation") then v.Transparency = 1 end end end for i = 1,minusFOV do cam.FieldOfView = cam.FieldOfView - 1 wait(0.01) end cam.FieldOfView = aimFOV end local function unaim() local cam = game.Workspace.CurrentCamera cam.FieldOfView = aimFOV game.Players.LocalPlayer.CameraMode = Enum.CameraMode.Classic local plusFOV = 70 - aimFOV aimgui.Parent = script for i,v in pairs(tool:GetChildren()) do if v.Name ~= "Fire" then if v:IsA("UnionOperation") then v.Transparency = 0 end end end for i = 1,plusFOV do cam.FieldOfView = cam.FieldOfView + 1 wait(0.01) end cam.FieldOfView = 70 end tool.Equipped:Connect(function() equipped = true aiming = false aimgui.Parent = script gungui.Parent = plr.PlayerGui anim[1] = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Idle) game.Workspace.CurrentCamera.FieldOfView = 70 mouse.Icon = "rbxassetid://166736756" wait(0.5) anim[1]:Play() end) tool.Unequipped:Connect(function() equipped = false aiming = false aimgui.Parent = script gungui.Parent = script anim[1]:Stop() mouse.Icon = "" game.Workspace.CurrentCamera.FieldOfView = 70 end) mouse.Button1Down:Connect(function() holding = true end) mouse.Button1Up:Connect(function() holding = false end) mouse.Button2Down:Connect(function() if equipped == true then aiming = true aim() end end) mouse.Button2Up:Connect(function() if equipped == true then aiming = false unaim() end end) mouse.KeyDown:Connect(function(key) local code = decode("byte", key) if code ~= nil then if equipped == true then if code == 114 then if config.AmmoInClip.Value < config.ClipSize.Value then if config.Remain.Value > 0 then remote:FireServer("reload") equipped = false wait(4) -- The reload time if script.Parent.Parent:IsA("Model") then equipped = true else equipped = false end elseif config.Unlimited.Value == true then remote:FireServer("reload") equipped = false wait(4) -- The reload time if script.Parent.Parent:IsA("Model") then equipped = true else equipped = false end end end end end end end) while wait(cooldown) do if equipped == true then if holding == true then local realSpread = spread if config.AmmoInClip.Value > 0 then if (mouse.hit.p - tool.Fire.Position).magnitude > 100 and (mouse.hit.p - tool.Fire.Position).magnitude <= 250 then realSpread = spread * 2 end if (mouse.hit.p - tool.Fire.Position).magnitude > 250 and (mouse.hit.p - tool.Fire.Position).magnitude <= 500 then realSpread = spread * 4 end if (mouse.hit.p - tool.Fire.Position).magnitude > 500 and (mouse.hit.p - tool.Fire.Position).magnitude <= 1000 then realSpread = spread * 6 end if (mouse.hit.p - tool.Fire.Position).magnitude > 1000 and (mouse.hit.p - tool.Fire.Position).magnitude <= 2500 then realSpread = spread * 8 end if (mouse.hit.p - tool.Fire.Position).magnitude > 2500 then realSpread = spread * 10 end if aiming == true then realSpread = spread / 2 end remote:FireServer("fire", mouse.Hit.p, realSpread) print("firing") else tool.Fire.Click:Play() end end end end
It may be because you're assigning a DecalId to the property. Rather assign the ImageId of it.
mouse.Icon = "rbxassetid://166736755"