What I mean, is how would I make this do 150 damage when it hits a player or a NPC? Also how to make it have a 2/4 chance of breaking that enemies joints if their MaxHealth is less than 1000?
pellet = script.Parent function onTouched(hit) humanoid = hit.Parent:findFirstChild("Humanoid") if humanoid~=nil then g = Instance.new("Explosion") g.ExplosionType = Enum.ExplosionType.NoCraters g.Parent = game.Workspace g.Position = script.Parent.Position g.BlastRadius = 5 g.BlastPressure = 1000 pellet:remove() else script.Parent.PelletScript2.Disabled = false script.Parent.PelletScript:remove() end end connection = pellet.Touched:connect(onTouched)
I made it so it does damage, and here is the code:
pellet = script.Parent damage = 5 -- the damage done. pellet.Touched:connect(function(hit) humanoid = hit.Parent:findFirstChild("Humanoid") if humanoid~=nil then humanoid:TakeDamage(damage) g = Instance.new("Explosion") g.ExplosionType = Enum.ExplosionType.NoCraters g.Parent = game.Workspace g.Position = script.Parent.Position g.BlastRadius = 5 g.BlastPressure = 1000 pellet:remove() else script.Parent.PelletScript2.Disabled = false script.Parent.PelletScript:remove() end end)