How should go about this?

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.

2 Likes

Make sure that u used CuttingBoard as a part name, not a model name.

I did, still doesn’t work for some reason.

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

Is there a way to make this work with models?

I don’t think so but maybe you could add invisible parts for that purpose?