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

How can i make a explosion that unjoint parts?

Asked by 5 years ago
Edited 5 years ago

i want make a explosion that unjoint 2 parts, i made 2 parts of same size and i put both with universal surface, i want an explosion that remove the universal surface of both or separate the parts, i tried but i cant

(i dont know edit the explosion)

1 answer

Log in to vote
0
Answered by
ABK2017 406 Moderation Voter
5 years ago

Some help with explosions from the Dev...

Fires when the Explosion hits a BasePart within its Explosion.BlastRadius. Returns the part hit along with the distance of the part from Explosion.Position. Note that the effect of an Explosion is not disrupted by obstacles, this means parts shielded behind other parts will still be hit, even if the BasePart they are shielded behind is anchored. This event will also fire when Explosion.BlastPressure is equal to zero. This means developers can program their own custom behavior for explosions by eliminating the explosion’s influence on BaseParts and Terrain. Note that this event will fire for every BasePart hit. This means it can fire multiple times for the same player character (as the character Model is made up of multiple parts). For this reason when dealing custom damage using the Explosion.Hit event it’s recommended to implement a check to see if the character has already been hit by the Explosion.


local function customExplosion(position, radius, maxDamage) local explosion = Instance.new("Explosion") explosion.BlastPressure = 0 -- this could be set higher to still apply velocity to parts explosion.DestroyJointRadiusPercent = 0 -- joints are safe explosion.BlastRadius = radius explosion.Position = position -- set up a table to track the models hit local modelsHit = {} -- listen for contact explosion.Hit:Connect(function(part, distance) local parentModel = part.Parent if parentModel then -- check to see if this model has already been hit if modelsHit[parentModel] then return end -- log this model as hit modelsHit[parentModel] = true -- look for a humanoid local humanoid = parentModel:FindFirstChild("Humanoid") if humanoid then local distanceFactor = distance / explosion.BlastRadius -- get the distance as a value between 0 and 1 distanceFactor = 1 - distanceFactor -- flip the amount, so that lower == closer == more damage humanoid:TakeDamage(maxDamage * distanceFactor) -- TakeDamage to respect ForceFields end end end) explosion.Parent = game.Workspace end
Ad

Answer this question