Quick backstory, im working on a module that creates these craters effects like the ones you see in combat warriors or the strongest battlegrounds. I have created the circle crater but i need guidance on how to create this effect.
here is a photo of what im trying to achieve:
The code below is the main basis to creating the rubble or crater effect.
for i = 1, (20 * Mod)/10 do
local segments = math.random(8, 12)
for i2 = 0, segments - 1 do
local potCf = CF * CFrame.Angles(0, math.rad(15/segments) * i2, 0) * CFrame.new(0,0,(i * -(20 * Mod)/3) - 5)
local result = workspace:Raycast(potCf.Position + Vector3.new(0, 3, 0), Vector3.new(0, -10, 0), params)
if result then
local hb = Instance.new("Part", workspace.Fx)
hb.Anchored = true
hb.CanCollide = cancollide
hb.Transparency = result.Instance.Transparency
hb.Color = result.Instance.Color
hb.Material = result.Material
hb.Name = "hb"
hb.CanQuery = false
hb.Size = Vector3.new(math.random(8,14) * 10 * Mod/segments, height, width)
hb.CFrame = potCf
hb.Position = result.Position - Vector3.new(0, 5, 0)
hb.CFrame *= CFrame.Angles(math.rad(math.random(10,45)), 0, 0)
ts:Create(
hb,
TweenInfo.new(.3, Enum.EasingStyle.Back, Enum.EasingDirection.Out),
{Position = hb.Position + Vector3.new(0, 3, 0)}
):Play()
--if shake == true then
-- camShake:Shake(CameraShaker.Presets.Explosion)
--else
-- return
--end
task.delay(lifetime,function()
ts:Create(
hb,
TweenInfo.new(.6, Enum.EasingStyle.Back, Enum.EasingDirection.In),
{Position = hb.Position - Vector3.new(0, 20 * Mod, 0)}
):Play()
end)
game.Debris:AddItem(hb, lifetime + 5)
end
end
wait()
end
Ive tried to create 2 position cframes and set them to 2 opposite directions, but they end up overlapping each other no matter to what size i set it. Please if you know what i need to fix or do, anything would be helpful!