Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How to Unanchor everything that is hit with an explosion?

Asked by
Nidoxs 190
9 years ago

I am awful at this scripting milaki so don't shout at me if I did it wrong like some people do. Please can I have help on how to do this? So everything and anything that is hit by an explosion gets Unanchored?

Instance.new("Explosion", script.Parent.Parent.Rotor.Rotor) 
Explosion:findFirstChild().Unanchor 
script.Parent.Parent.Rotor.Rotor.Explosion.BlastPressure = 1.79769e+308 
script.Parent.Parent.Rotor.Rotor.Explosion.BlastRadius = 100 
script.Parent.Parent.Rotor.Rotor.Explosion.Position = Vector3.new(-181.343, 65.794, -48.842)
end

1 answer

Log in to vote
0
Answered by
BlackJPI 2658 Snack Break Moderation Voter Community Moderator
9 years ago

There is a convenient event of every explosion called hit. This is fired when the explosion hits a Part.

Instance.new("Explosion", script.Parent.Parent.Rotor.Rotor) 

Explosion.Hit:connect(function(part, distance) -- Hit event
    part.Anchored = false -- Unanchor hit part
end)

script.Parent.Parent.Rotor.Rotor.Explosion.BlastPressure = 1.79769e+308 
script.Parent.Parent.Rotor.Rotor.Explosion.BlastRadius = 100 
script.Parent.Parent.Rotor.Rotor.Explosion.Position = Vector3.new(-181.343, 65.794, -48.842)
0
This did not work for me, sorry. :( Nidoxs 190 — 9y
0
Sorry, my bad! It did! Nidoxs 190 — 9y
0
There is no need for the end on line 10 because it is not closing anything! Perci1 4988 — 9y
1
Why not set a variable for the new instance, instead of referencing it the long way from lines 7-9? Spongocardo 1991 — 9y
0
Haha my bad, I didn't look over the code, just added the unachor part into his script. BlackJPI 2658 — 9y
Ad

Answer this question