I have made an explosion effect with the use of meshes and tweenservice, it works as intended however, it’s a bit choppy and i can’t really find what’s wrong with it. The smoke doesn’t trail off as intended and it just kind of cuts to the smoke at a smaller size growing bigger again then dissapears:
https://gyazo.com/97a0dbdd29509e1edff2f1ea1fcbda58
Here’s my code if you can catch anything out:
local respos = script.Parent.PrimaryPart.Position
local respawntime = 2
local num = 0
local tweenservice = game:GetService("TweenService")
local timing = false
local tweeninginfo0 = TweenInfo.new(
1,
Enum.EasingStyle.Sine,
Enum.EasingDirection.Out,
1,
false,
0
)
local Cloud = {
Size = Vector3.new(96, 72, 80);
}
local Cel = {
Size = Vector3.new(99, 74, 82);
}
local Fire = {
Size = Vector3.new(76, 56, 62);
}
local tweeninginfo1 = TweenInfo.new(
.6,
Enum.EasingStyle.Sine,
Enum.EasingDirection.In,
1,
false,
0
)
local fade = {
Transparency = 1;
}
local firefade = {
Transparency = 1;
Size = Vector3.new(0,0,0);
Color = Color3.fromRGB(163, 162, 165);
}
local function Explode()
local cloudfx = game.ReplicatedStorage.ExplodeFX:Clone()
local cloudcel = cloudfx.CelCloud
cloudfx.CloudFX.Size = Vector3.new(0,0,0)
cloudcel.Size = Vector3.new(0.25,0.25,0.25)
cloudfx.Fire1.Size =Vector3.new(0,0,0)
cloudfx.Fire.Size = Vector3.new(0,0,0)
cloudfx.Parent = game.Workspace
local tween1 = tweenservice:Create(cloudfx.CloudFX, tweeninginfo0, Cloud)
local tween2 = tweenservice:Create(cloudcel, tweeninginfo0, Cel)
local tween3 = tweenservice:Create(cloudfx.Fire, tweeninginfo0, Fire)
local tween4 = tweenservice:Create(cloudfx.Fire1, tweeninginfo0, Fire)
cloudfx:SetPrimaryPartCFrame(CFrame.new(script.Parent.PrimaryPart.Position))
script.Parent.PrimaryPart.Anchored = true
tween1:Play()
tween2:Play()
tween3:Play()
tween4:Play()
local explosion = Instance.new("Explosion", script.Parent.PrimaryPart)
explosion.Position = script.Parent.PrimaryPart.Position
explosion.Visible = false
explosion.DestroyJointRadiusPercent = 0
explosion.BlastRadius = 50
explosion.BlastPressure = 100000
explosion.ExplosionType = "NoCraters"
wait(1)
local tweenB1 = tweenservice:Create(cloudfx.CloudFX, tweeninginfo1, fade)
local tweenB2 = tweenservice:Create(cloudcel, tweeninginfo1, fade)
local tweenB3 = tweenservice:Create(cloudfx.Fire, tweeninginfo1, firefade)
local tweenB4 = tweenservice:Create(cloudfx.Fire1, tweeninginfo1, firefade)
local explosion1 = Instance.new("Explosion", script.Parent.PrimaryPart)
explosion1.Position = script.Parent.PrimaryPart.Position
explosion1.Visible = false
explosion1.DestroyJointRadiusPercent = 0
explosion1.BlastRadius = 10
explosion1.BlastPressure = 1000000
explosion1.ExplosionType = "NoCraters"
cloudfx.Fire.Material = "Concrete"
cloudfx.Fire1.Material = "Concrete"
script.Parent:SetPrimaryPartCFrame(CFrame.new(respos))
script.Parent.PrimaryPart.Anchored = false
tweenB1:Play()
tweenB2:Play()
tweenB3:Play()
tweenB4:Play()
wait(.6)
cloudfx:Destroy()
explosion:Destroy()
explosion1:Destroy()
end
script.Parent.PrimaryPart.ChildAdded:Connect(function()
timing = true
end)
while wait(1) do
if timing == true then
num = num + 1
if script.Parent.PrimaryPart:FindFirstChild("IsGrabbed") then
num = 0
end
if num >= respawntime then
Explode()
num = 0
timing = false
end
end
end