Whatever the paintball hits, it creates an explosion that does 25-1000 damage depending on if it's a direct hit or splash damage. Anyone help? By the way, blast pressure is 0, and blast radius I will determine.
ball = script.Parent damage = 25 function onTouched(hit) local humanoid = hit.Parent:findFirstChild("Zombie") if humanoid ~= nil then tagHumanoid(humanoid) humanoid.Health = humanoid.Health - damage wait(2) untagHumanoid(humanoid) end connection:disconnect() ball.Parent = nil end function tagHumanoid(humanoid) -- todo: make tag expire local tag = ball:findFirstChild("creator") if tag ~= nil then local new_tag = tag:clone() new_tag.Parent = humanoid end end function untagHumanoid(humanoid) if humanoid ~= nil then local tag = humanoid:findFirstChild("creator") if tag ~= nil then tag.Parent = nil end end end connection = ball.Touched:connect(onTouched) wait(0.8) ball.Parent = nil
Go to this link: Explosion Damage. It will give you everything you need. Hope this helped!
Well this would be how to create the explosion. I'm kinda lost on how to make the damage part.
ball = script.Parent damage = 25 function onTouched(hit) local humanoid = hit.Parent:findFirstChild("Zombie") E=Instance.new("Explosion",game.Workspace) E.Position=humanoid.Position E.BlastPressure=0 E.BlastRadius= --Enter what you want here. if humanoid ~= nil then tagHumanoid(humanoid) humanoid.Health = humanoid.Health - damage wait(2) untagHumanoid(humanoid) end connection:disconnect() ball.Parent = nil end function tagHumanoid(humanoid) -- todo: make tag expire local tag = ball:findFirstChild("creator") if tag ~= nil then local new_tag = tag:clone() new_tag.Parent = humanoid end end function untagHumanoid(humanoid) if humanoid ~= nil then local tag = humanoid:findFirstChild("creator") if tag ~= nil then tag.Parent = nil end end end connection = ball.Touched:connect(onTouched) wait(0.8) ball.Parent = nil