Hi forum. Today i want learn how i can make a crack effect.
I tried do something but it not that i want
local startpoint = game.Workspace:WaitForChild("StartPoint")
local function MakeCrack(lastpart)
local part = Instance.new("Part")
part.CanCollide = false
part.Anchored = true
part.Size = Vector3.new(4,0.3,0.3)
if lastpart == nil then
part.CFrame = startpoint.CFrame
else
part.CFrame = lastpart.CFrame
end
part.CFrame = part.CFrame * CFrame.new(startpoint.Size.X/2,0,0) * CFrame.Angles(0,0,math.rad(math.random(-45,45)))
part.CFrame = part.CFrame * CFrame.new(part.Size.X/2,0,0)
part.Parent = workspace
return part
end
while true do
game:GetService("RunService").Stepped:Wait()
local part = MakeCrack(lastpart)
lastpart = part
end
Script it to have a percentage type system that at the end of every segment of the crack has a 25% (or whatever you find works best) chance of splitting into 2 more cracks, each with the segment of code that may split again.
Seems your script isn’t checking to see the length of the crack it creates. Maybe use a random number generator that decides at the beginning how many loops the code will run through to create segments before splitting again?