Tool = script.Parent Player = Tool.Parent.Parent mouse = Player:GetMouse()
Tool.RemoteEvent.OnServerEvent:Connect(function()
local Ammo = 5
if Ammo > 0 then
local Bullet = Instance.new("Part", game.Workspace)
game.Debris:AddItem(Bullet, 2)
Bullet.Shape = "Ball"
Bullet.TopSurface = "Smooth"
Bullet.BottomSurface = "Smooth"
Bullet.BrickColor = BrickColor.new ("Dark stone grey")
Bullet.CanCollide = false
Bullet.CFrame = Tool.Handle.CFrame
Bullet.CFrame = CFrame.new(Bullet.Position,mouse.Hit.p)
local v = Instance.new("BodyVelocity")
v.Parent = Bullet
v.velocity = Bullet.CFrame.lookVector * 90
v.MaxForce = Vector3.new(math.huge, math.huge, math.huge) Ammo = Ammo - 1 print("You have" ..Ammo.. "ammo left in your gun!") end
end)

1 comment
Tool.Parent.Parent.mouse