I am trying to make an explosion script that basically when a model blows up, leads to a explosion; not like the regular(Explosions from the instance). I am basically trying to make for say a transparent sphere after the explosion. Is there anyway I can get some tips on making this, it's incredibly confusing. Thanks.
function Explode(position, growsize, color, parent, speed, startsize) coroutine.resume(coroutine.create(function() p = Instance.new("Part", parent) p.Anchored = true p.BrickColor = BrickColor.new(color) p.CFrame = CFrame.new(position) p.Shape = 0 p.FormFactor = 3 p.Size = Vector3.new(startsize.X, startsize.Y, startsize.Z) for i=1, growsize * 4 do wait(speed / (growsize * 4)) p.Size = p.Size + Vector3.new(0.25, 0.25, 0.25) end p:Remove() end)) end
Position is the Vector3 position of where you want it to be, growsize is the integer value of what you want it to grow to, color is the string value color, parent is obviously where you want it parented, speed is in seconds how long it takes to grow, and startsize is the Vector3 value of the size it starts as.
Call like so:
Explode(Vector3.new(0, 0, 0), 30, "Really red", game.Workspace, 4, Vector3.new(1, 1, 1))