Moving forward with my rockets, Here is where I am at right now.
ball = script.Parent damage = 100 function onTouched(hit) local humanoid = hit.Parent:findFirstChild("Humanoid") if humanoid~=nil then tagHumanoid(humanoid) humanoid.Health = humanoid.Health - damage wait(0.00000001) untagHumanoid(humanoid) connection:disconnect() else damage = damage / 2 if damage < 2 then connection:disconnect() ball.Parent = nil end end if math.random(1,1) == 1 then explosion = Instance.new("Explosion") explosion.BlastRadius = 2 explosion.BlastPressure = 500000 explosion.Position = script.Parent.Position explosion.Parent = game.Workspace connection:disconnect() ball.Parent = nil cancollide = true end 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) r = game:service("RunService") t, s = r.Stepped:wait() d = t + 5.0 - s while t < d do t = r.Stepped:wait() end ball.Parent = nil
What I want is if the rocket hits a wall or something I can specify rather than any object (like the baseplate), How do I make it so it only damages what it contacts rather than the humanoid behind cover? (not looking for a Jointbreaker)