I'd like to make an anchored part react to an explosion. I've tried an onTouch script......
function T(hit) if hit.ClassName==("Explosion") then script.Parent.Anchored=false end end script.Parent.Touched:connect(T)
But I already pretty much knew that wouldn't work. Help is appreciated! :D
There is an event called the Hit event. It fires when an explosion hits something.
The script is the event of the explosion, you could clone a script into the explosion as soon as it is created. The script should be:
script.Parent.Hit:connect(function(Part, PartDistance) if Part:IsA("BasePart") and Part.Anchored and not Part.Locked then Part.Anchored = false end end)
Explosions don't use the Touched script like how parts do.
Parameters for Hit(Explosion):
Part; Object Value The Part that gets hit by the explosion
PartDistance; Float; The distance the part is from the explosion when the part got hit
Other stuff:
IsA sees what class the object belongs to
Anchored is when a part doesn't move
Hope this helps!