Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-2

How do you make a filter enabling damage script?

Asked by 5 years ago
Edited by User#24403 5 years ago

This is the damage script I want the player to take damage but it does take damage however, I test it in game and the player did take damage but when I print the health. It's the same as the maxHealth this means the player took damage on a client but not on the server. How could I make the player take damage on the server?

```lua local damage = staff.Touched:connect(function(h) local tag = h.Parent if impact == true then impact = false hitsound:Play() end if tag:findFirstChild("HumanoidRootPart") then if tag:findFirstChild("Pvp") and tag.Name == (script.Parent.track.targeting.Value).Name then if tag.Pvp.Value == true then if tag:findFirstChild("Humanoid") then tag.Humanoid.Health = tag.Humanoid.Health -5 if tag.HumanoidRootPart:findFirstChild("BodyVelocity") then else local bv = Instance.new("BodyVelocity", tag.HumanoidRootPart) bv.MaxForce = Vector3.new(math.huge,math.huge,math.huge) bv.Velocity = char.HumanoidRootPart.CFrame.lookVector *75 end if tag.HumanoidRootPart:findFirstChild("shock") then tag.HumanoidRootPart.shock:Destroy() end if tag.HumanoidRootPart:findFirstChild("shock") then tracking.HumanoidRootPart.shock:Destroy() else local shock = game.Lighting.Guns.LaserBo.shock:Clone() shock.Parent = tracking.HumanoidRootPart end if tag.HumanoidRootPart:findFirstChild("shocklight") then else local shock = game.Lighting.Guns.LaserBo.shock:Clone() shock.Parent = tracking.HumanoidRootPart end wait(0.25) if tag.HumanoidRootPart:findFirstChild("BodyVelocity") then tag.HumanoidRootPart:findFirstChild("BodyVelocity"):Destroy() end if tag.HumanoidRootPart:findFirstChild("shock") then tracking.HumanoidRootPart.shock:Destroy() end if tag.HumanoidRootPart:findFirstChild("shocklight") then tag.HumanoidRootPart:findFirstChild("shocklight"):Destroy() end end if tag:findFirstChild("Target") then if tag.Name == player.Name then else tag.Target.Health = tag.Target.Health -5 if tag.HumanoidRootPart:findFirstChild("shock") then tag.HumanoidRootPart.shock:Destroy() end if tag.HumanoidRootPart:findFirstChild("BodyVelocity") then >

else local bv = Instance.new("BodyVelocity", tag.HumanoidRootPart) bv.MaxForce = Vector3.new(math.huge,math.huge,math.huge) bv.Velocity = char.HumanoidRootPart.CFrame.lookVector *75 end if tag.HumanoidRootPart:findFirstChild("shock") then tracking.HumanoidRootPart.shock:Destroy() else local shock = game.Lighting.Guns.LaserBo.shock:Clone() shock.Parent = tracking.HumanoidRootPart end if tag.HumanoidRootPart:findFirstChild("shocklight") then else local shock = game.Lighting.Guns.LaserBo.shock:Clone() shock.Parent = tracking.HumanoidRootPart end wait(0.25) if tag.HumanoidRootPart:findFirstChild("BodyVelocity") then tag.HumanoidRootPart:findFirstChild("BodyVelocity"):Destroy() end if tag.HumanoidRootPart:findFirstChild("shock") then tracking.HumanoidRootPart.shock:Destroy() end if tag.HumanoidRootPart:findFirstChild("shocklight") then tag.HumanoidRootPart:findFirstChild("shocklight"):Destroy() end end end end end end end) ```

1
Why aren't you indenting? Also make sure to add comments and create snippets of code as nobody is willing to read an 83 line of code script. Mr_Unlucky 1085 — 5y
0
Hey, this is something like long code. ArtyomAL3X 12 — 5y

Answer this question