Hi! I want to make a model explode. It’s like the sentry in big paintball where when it gets shot it explodes and gets destroyed a few seconds later. But I couldn’t seem to figure out how to do it. Please help
Can’t write the code for you but heres a quick outline:
- Make a
.Touched
function trigger when specific part touches part - Write script to create explosion
- Trigger explosion and unanchor all children of the model for big boom
1 Like
i only need the second point which is making the explosion
Just loop threw the children of the model, make it un anchored and add a explosion. Boom.
oh. how to add explosion though?
when it gets shot alr
local Model = script.Parent -- Ur Model Thingy
local Object = Model.Part -- Example a Part cuz Model cant be touched
---------------------------------------------------------------------
local Connection -- Variable for inside function disconnecting
Connection = Object.Touched:Connect(function(Hit) -- Function
if Hit.Parent.Name == "Bullet" then -- Confirm the object if its a bullet (I JUST USED THE NAME PROPERTY)
Connection:Disconnect() -- stop the repetition
local Explosion = Instance.new("Explosion") -- Explosion added
Explosion.Parent = Object
Explosion.Position = Object.Position
wait(5) -- Delay time for the model destroy after the explosion
Model:Destroy() -- Destroying the model
end
end)
1 Like