Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Mouse Cursor isn't loading?

I made a script to my game, and its supose to make a gun, but it is not working. I started getting this error: 18:28:05.943 - Image "https://assetgame.roblox.com/asset/?id=358948941" failed to load in "Mouse Cursor": Request failed

Here's my script:

-- Algumas variaveis --
local pistola = script.Parent
local hole = pistola:WaitForChild("Hole")
local mouse = game.Players.LocalPlayer:GetMouse()

-- Lista de Valores --
local ammo = 12
local maxAmmo = 64
local damage = 20
local headshotDamage = 50
local range = 100
local coolDown = 0.5
 
-- impedir spamming --
local spam = false

-- Mudar o rato --
pistola.Equipped:Connect(function()
	mouse.Icon = "rbxassetid://358948941"
end)

pistola.Unequipped:Connect(function()
	mouse.Icon = ""
end)

-- Disparo --
pistola.Activated:Connect(function()
	if spam == false then
		 spam = true
		pistola.Handle.Disparo:Play()
       local bullet = Instance.new("Part")
	   bullet.Size = Vector3.new(range,0.25,0.25)
	   local ray = Ray.new(hole.CFrame.Position, (mouse.Hit.Position - hole.CFrame.Position).Unit*range)
	   local hit, position = workspace:FindPartOnRay(ray, game.Players.LocalPlayer.Character)
	   local distance = (pistola.Handle.CFrame.p - position).magnitude
	   bullet.CFrame = CFrame.new(pistola.Handle.CFrame.p, position) * CFrame.new(0,0, distance/2)
	   bullet.Transparency = 0.5
	   bullet.CanCollide = false
	   bullet.Anchored = true
	   bullet.Parent = game.Workspace
	   bullet.Orientation = hole.Orientation
	   bullet.Position = hole.Position
	game:GetService("Debris"):AddItem(bullet, 0.5) 
	    spam = false
	end	
end)

Also pistola = gun. XD

Here's a video of what my gun is doing : http://gyazo.com/1cf05bb4a57ad9a37866f40546380fd7

Could you help me fixing this? (also send a answer, not a comment :/ i think i shouldn't have to say this but ppl always send comment insteed of answers :/)

2 answers

✓ Accepted answer

Assets can sometimes be buggy

mouse.Icon = "rbxassetid://358948940"

Try subtracting the id by -1

mouse.Icon = "rbxassetid://358948939"

1 comment

0

thank you!

This is because you're using the wrong AssetID for line 19.

I checked on the main site and I'm sure this id is the correct one:

mouse.Icon = "rbxassetid://358948940"

The one you had was an ID to the Decal. You want to use the Image Id which you get by subtracting the ID by 1. Recently, as asset creation has sped up due to more players uploading on Roblox, you might need to subtract the id even more.

This discussion is preserved as it was. New answers, comments, and votes are closed.