I wanted to make it that when an Object with an specific name (in this case BallBall) will touch the Part with the script in it, the Part with the script will explode. But I can not get the right possition of the Explosion. I want the explosion to happen inside or ontop of the Part with the script in it. btw I dont want the Part with the script to be destroyed I want it to explode infinite times.
01 | script.Parent.Touched:Connect( function (Part) |
02 | if Part.Name = = "BallBall" then |
03 |
04 | local explosion = Instance.new( "Explosion" ) |
05 | explosion.Parent = script.Parent |
06 | explosion.Parent = script.Parent.CFrame < -- This is the Part im struggling with. |
07 | explosion.BlastRadius = 14 |
08 | explosion.BlastPressure = 5000 |
09 | end |
10 | end ) |
In Line 6 you typed: explosion.parent = script.parent.CFrame
and not explosion.Position = script.parent.Position
. Also, you want it to explode infinity? make sure you use while wait(0.2) do
01 | script.Parent.Touched:Connect( function (Part) |
02 | if Part.Name = = "BallBall" then |
03 | while wait( 0.2 ) do --- While wait() do prevents the game from breaking |
04 | local explosion = Instance.new( "Explosion" ) |
05 | explosion.Parent = script.Parent |
06 | explosion.Position = script.Parent.Position |
07 | explosion.BlastRadius = 14 |
08 | explosion.BlastPressure = 5000 |
09 | end |
10 | end |
11 | end ) |
However, you can use these as well:
01 | script.Parent.Touched:Connect( function (Part) |
02 | if Part.Name = = "BallBall" then |
03 | while true do |
04 | local explosion = Instance.new( "Explosion" ) |
05 | explosion.Parent = script.Parent |
06 | explosion.Position = script.Parent.Position |
07 | explosion.BlastRadius = 14 |
08 | explosion.BlastPressure = 5000 |
09 | wait() |
10 | end |
11 | end |
12 | end ) |