I made a gun, and it shoots, but when I shoot someone dead, they are still alive on their screen, but on my screen, they are dead but don't respawn, please help me, I've been trying for hours to find a good way to script my gun without having any reloading or GUI stuff, so here's the script:
Player = game.Players.LocalPlayer mouse = Player:GetMouse() maxAmmo = 50 ammo = maxAmmo rate = 0.1 firing = false Canfire = true reload = 5 damage = 20 script.Parent.Activated:Connect(function() if ammo >= 1 and Canfire == true then firing = true repeat local bullet = Instance.new("Part", workspace) bullet.CanCollide = true bullet.Shape = "Ball" bullet.Size = Vector3.new(0.4, 0.4, 0.4) bullet.Material = "Neon" bullet.BrickColor = BrickColor.new("Bright yellow") bullet.CFrame = CFrame.new(script.Parent.Handle.Position, mouse.Hit.p) local v = Instance.new("BodyVelocity", bullet) v.Velocity = bullet.CFrame.LookVector*520 game.Debris:AddItem(bullet,5) bullet.Touched:connect(function(hit) if hit.Parent ~= Player.Character and hit.Parent:FindFirstChild("Humanoid") then hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - damage bullet:Destroy() end end) wait(rate) until ammo < 1 or firing == false end end) script.Parent.Deactivated:Connect(function() if firing == true then firing = false end end) mouse.KeyDown:connect(function(key) if string.lower(key) == "r" and ammo < maxAmmo and firing == false then Canfire = false wait(reload) ammo = maxAmmo Canfire = true end end)
they are still alive on their screen, but on my screen, they are dead but don't respawn
This means you are using a localscript, you will need to use remotefunctions/events and a script to make the damage work, also remember to protect your remotefunction/events!