So i made this script that is saposed to make an explosion effect wherever the 2 parts collide
I have an on touched script that clones the following script into whatever is touching the part, in this case a players body part, whenever you or a npc touches the player an explosion part will appear whereever the 2 parts touched
The problem is that sometimes when i touch another humanoid the explosions would appear over my should if something were to touch on of my legs
local ExplosionPart = Instance.new('Part',workspace)
ExplosionPart.CFrame = script.Parent.CFrame
ExplosionPart.Anchored = true
ExplosionPart.CanCollide = false
ExplosionPart.Size = Vector3.new(1,1,1)
ExplosionPart.BrickColor = BrickColor.new('Really black')
ExplosionPart.Material = 'Neon'
ExplosionPart.Transparency = 0.5
ExplosionPart.Shape = 'Ball'
local start = ExplosionPart.Size
local finish = ExplosionPart.Size * Vector3.new(2,2,2)
local disipate = script.DisipateEffect:Clone()
disipate.Parent = ExplosionPart
disipate.Disabled = false
for progress = 0, 1, 0.03 do
ExplosionPart.Size = start:lerp(finish, progress)
wait()
end
script:Destroy()
Here is the script that clones the script above into the part that touched the players body part
function onDamage(Part)--function to cause damage to those hit with fireball
if Part.Parent:FindFirstChild("Humanoid") ~=nil and Part.Parent.Name ~= "script.Parent.Name" then--If the thing is humanoid then
script.Disabled = false
local effect = script.GiantEffect:Clone()
effect.Parent = Part
effect.Disabled = false
Part.Parent.Humanoid:TakeDamage(45)
print('DAMAGED')
end--end the second argument of code chunk
end--end the thrid argument of code chunk
script.Parent.Touched:connect(onDamage)
