Whenever I make it so that the mouse icon changes correspondingly to when the gun is equipped or when it's reloading, it shows an error saying that it failed to load. Why is it doing that? Has anyone else experienced this?
--MADE BY MR_UNLUCKY
local tool = script.Parent
local player = game:GetService("Players").LocalPlayer
local Reload = tool.Reload
local Shoot = tool.Shot
local GUI = tool.ScreenGui
local damageBODY = 10
local damageHEAD = 30
local Equip = tool.Equip
local bullets = 15
local Players = game:GetService("Players")
local mouse = game.Players.LocalPlayer:GetMouse()
tool.Equipped:connect(function(mouse)
print("Tool equipped!")
local newGUI = GUI:Clone()
newGUI.Parent = Players.LocalPlayer.PlayerGui
Players.LocalPlayer.PlayerGui.ScreenGui.Frame.Bullets.Text = "Bullets:"..bullets..""
Players.LocalPlayer.PlayerGui.ScreenGui.Frame.GunName.Text = tool.Name
mouse.Icon = "http://www.roblox.com/asset?id=936803887"
mouse.Button1Down:connect(function()
if bullets <= 0 then
Reload:Play()
mouse.Icon = "http://www.roblox.com/asset?id=43557168"
Players.LocalPlayer.PlayerGui.ScreenGui.Frame.Bullets.Text = "RELOADING"
wait(3.2)
bullets = 15
Players.LocalPlayer.PlayerGui.ScreenGui.Frame.Bullets.Text = "Bullets:"..bullets..""
mouse.Icon = "http://www.roblox.com/asset?id=936803887"
else
print("Mouse pressed!")
local ray = Ray.new(tool.Handle.CFrame.p, (mouse.Hit.p - tool.Handle.CFrame.p).unit * 300)
local part, position = workspace:FindPartOnRay(ray, player.Character, false, true)
local beam = Instance.new("Part", workspace)
beam.BrickColor = BrickColor.new("Medium stone grey")
beam.FormFactor = "Custom"
beam.Material = "Metal"
beam.Transparency = 0.25
beam.Anchored = true
beam.Locked = true
beam.CanCollide = false
bullets = bullets - 1
print(bullets)
local distance = (tool.Handle.CFrame.p - position).magnitude
beam.Size = Vector3.new(0.3, 0.3, distance)
beam.CFrame = CFrame.new(tool.Handle.CFrame.p, position) * CFrame.new(0, 0, -distance / 2)
Shoot:Play()
game:GetService("Debris"):AddItem(beam, 0.1)
Players.LocalPlayer.PlayerGui.ScreenGui.Frame.Bullets.Text = "Bullets:"..bullets..""
if part then
local rightLeg = part.Parent:FindFirstChild("RightLeg")
local leftLeg = part.Parent:FindFirstChild("LeftLeg")
local rightArm = part.Parent:FindFirstChild("RightArm")
local leftArm = part.Parent:FindFirstChild("LeftArm")
local torso = part.Parent:FindFirstChild("Torso")
local head = part.Parent:FindFirstChild("Head")
local humanoid = part.Parent:FindFirstChild("Humanoid")
if not rightLeg or leftLeg or rightArm or leftArm or torso or head then
local rightLeg = part.Parent:FindFirstChild("RightLeg")
local leftLeg = part.Parent:FindFirstChild("LeftLeg")
local rightArm = part.Parent:FindFirstChild("RightArm")
local leftArm = part.Parent:FindFirstChild("LeftArm")
local torso = part.Parent:FindFirstChild("Torso")
local head = part.Parent:FindFirstChild("Head")
end
if rightLeg or leftLeg or rightArm or leftArm or torso then
humanoid:TakeDamage(damageBODY)
end
if head then
humanoid:TakeDamage(damageHEAD)
end
end
end
tool.Unequipped:connect(function(mouse)
Players.LocalPlayer.PlayerGui:FindFirstChild("ScreenGui"):Destroy()
end)
end)
end)

1 comment
You're using decal ids while you should be using image ids