I want to make it where an egg can crack in half, I first tried using a raycast with no success. So I have tried to make it when if the egg collides with a part it will break in half.
workspace.EggsFolder.ChildAdded:Connect(function(Egg)
Egg.Touched:Connect(function(partTouching)
if partTouching.Name == "CuttingBoard" then
Egg:Destroy()
end
end)
end)
This is what I have so far, would it be easier to make the crack or make different models for it procedurally? Also, the code above doesn’t work, I’m still trying to figure it out.
Put this script inside the part that interacts with the egg.
local overlapParams = OverlapParams.new()
local part = script.Parent -- CuttingBoard
while wait() do
local touchingList = workspace:GetPartsInPart(part, overlapParams)
if #touchingList ~= 0 then
for v,i in ipairs(touchingList) do
if i.Name == "EggName" then
i:Destroy()
end
end
end
end