-- Add remote event in ReplicatedStorage. (Rename to FireEvent) -- // LOCAL SCRIPT IN GUN \\-- (Parent is the tool NOT the handle) local gun = script.Parent local sound = gun.Handle:WaitForChild("SOUND NAME") -- REPLACE WITH SOUND NAME IN HANDLE local player = game.Players.LocalPlayer local mouse = player:GetMouse() mouse.Icon = 'rbxassetid://2827093428' local ReplicatedStorage = game:GetService('ReplicatedStorage') local remoteEvent = ReplicatedStorage:WaitForChild('FireEvent') local shooting = false local equipped = false local spare_ammo = 210 local ammo = 30 local FireRate = 0.13 -- (To find your firerate think of a decimal then multiply it by your amount of ammo and the answer is how many seconds you will be shooting before you run out of ammo.) local mouseConnection local function reload() if spare_ammo >= 30 then spare_ammo -= 30 ammo = 30 -- add reload animation else ammo = spare_ammo spare_ammo -= spare_ammo -- add reload animation end end gun.Equipped:Connect(function() mouse.Button1Down:Connect(function() shooting = true while shooting and equipped or ammo > 0 do ammo = ammo - 1 remoteEvent:FireServer(gun.Handle.Position, gun.Handle.Orientation, mouse.Hit.p) sound:Play() -- add recoil/kick animation mouse.Button1Up:Connect(function() shooting = false end) if ammo == 0 and spare_ammo > 0 then reload() end wait(FireRate) end end) end) gun.Unequipped:Connect(function() equipped = false mouseConnection:Disconnect() end) --// SCRIPT IN SERVERSCRIPTSERVICE \\-- local ReplicatedStorage = game:GetService('ReplicatedStorage') local remoteEvent = ReplicatedStorage:WaitForChild('FireEvent') remoteEvent.OnServerEvent:Connect(function(player, gunPos, gunOr, mosPos) local bullet = Instance.new('Part') bullet.Name = "Bullet" bullet.Parent = game.Workspace bullet.Shape = Enum.PartType.Cylinder bullet.Size = Vector3.new(0.2, 0.2, 0.2) bullet.BrickColor = BrickColor.new('Gold') bullet.Material = Enum.Materal('Neon') local speed = 300 bullet.CFrame = CFrame.new(gunPos, mosPos) bullet.Velocity = bullet.CFrame.lookVector * speed game:GetService("Debris"):AddItem(bullet, 2) bullet.Touched:Connect(function(hit) if hit.Parent:WaitForChild("Humanoid") and not hit.Name == "Head" then hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - 10 elseif hit.Parent:WaitForChild("Humanoid") and hit.Name == "Head" then hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - 35 end end) end)