Meteor script that destroys other parts it touches is not working, help?
So i have gotten help to fix this, and it has gotten better but theres still problems with it. When i hit run to test it, the baseplate has an explosion in the middle of it and gets destroyed even though the Meteor didn't touch it, and also when the Meteor falls onto a part i added in for testing, the explosion gets created in the middle of the part, and also does not get destroyed. I have a separate explosion script from the one i need help with, but i don't know if thats the problem because the explosion does not happened wherever it hit on the part but in the middle of it.
So this is the script for the parts it touches to get destroyed:
01 | local meteor = Instance.new( 'Part' , game.Workspace) |
03 | meteor.Anchored = false |
05 | meteor.Touched:connect( function (part) |
06 | if part.Name ~ = 'BasePlate' then |
07 | local boom = Instance.new( 'Explosion' , game.Workspace) |
08 | boom.Position = part.Position |
And this is the explosion script:
01 | function onTouched(hit) |
02 | if hit.Parent ~ = nil then |
03 | if (hit.Parent ~ = game.Workspace) then |
04 | e = Instance.new( "Explosion" ) |
05 | e.Parent = game.Workspace |
06 | e.Position = hit.Position |
08 | e.BlastPressure = 1000000 |
09 | hit.Parent:BreakJoints() |
11 | e = Instance.new( "Explosion" ) |
12 | e.Parent = game.Workspace |
13 | e.Position = hit.Position |
15 | e.BlastPressure = 1000000 |
20 | script.Parent.Touched:connect(onTouched) |