--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()
local clips = 3
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 = "rbxassetid://936803874" --the image id of the decal is 936803874
mouse.Button1Down:connect(function()
if bullets <= 0 and clips >= 1 then
Reload:Play()
mouse.Icon = "rbxassetid://43557167" --the image id of the decal is 43557167
Players.LocalPlayer.PlayerGui.ScreenGui.Frame.Bullets.Text = "RELOADING"
wait(3.2)
bullets = 15
Players.LocalPlayer.PlayerGui.ScreenGui.Frame.Bullets.Text = ""..bullets.."/"..clips..""
mouse.Icon = "rbxassetid://936803887" --the image id of the decal is 936803887
clips = clips - 1
elseif clips == not 0 then
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.."/"..clips..""
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
tool.Unequipped:connect(function()
Players.LocalPlayer.PlayerGui.ScreenGui:Destroy()
end)
end
end)
end)
COMMUNITY QUESTION
Why cant my gun isn't shooting bullets like it used to?
0 answers
No public answers were preserved for this question.
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Tsk tsk tsk, straight off roblox wiki
yes but i modified it so it has a bullet counter and head shot detection.