CanCollide, Transparency problem

I’m trying to do a doodle jump system, where you can go through the bottom part of the mesh/part and stand on top of the mesh/part.The code breaks sometimes and I don’t understand why.
It works here.

External Media

And it doesn’t work here:

External Media

Thats the code:

local bossFightsNumber = {6,15,28,46,70,101,149,207,276,360,469,653}

local function createPlatform()
	local starterPlatform = workspace.Naruto.StartPlatform:Clone()
	starterPlatform.Parent = workspace.Platforms
	starterPlatform.CFrame = workspace.Platforms.FirstPart.CFrame
	
	local count = 1
	local maxCount = 653
	while true do
		print(table.find(bossFightsNumber, count) == nil)
		if table.find(bossFightsNumber, count) == nil then
			local newPart = Instance.new("Part")
			newPart.Anchored = true
			newPart.Transparency = 1
			newPart.Parent = workspace.Platforms.ReferenceParts
			newPart.Name = count

			local oldPartName = count - 1
			local oldPart = workspace.Platforms.ReferenceParts:FindFirstChild(oldPartName)
			if oldPart then
				local oldX = oldPart.CFrame.Position.X
				local distance = oldX - workspace.Platforms.FirstPart.CFrame.Position.X
				local X

				if distance > 0 then
					X = math.random(-distance, distance)
				else
					X = math.random(distance, -distance)
				end
				if distance < 10 or distance > -10 then
					X = math.random(-60,60)
				end
				local Y = oldPart.CFrame.Position.Y
				newPart.CFrame = CFrame.new(workspace.Platforms.FirstPart.CFrame.Position + Vector3.new(X,Y+40,0))
			else
				local X = math.random(-60,60)
				newPart.CFrame = CFrame.new(workspace.Platforms.FirstPart.CFrame.Position + Vector3.new(X,30,0))
			end

			local NarutoPlatform = workspace.Naruto.Platform:Clone()
			NarutoPlatform.Parent = workspace.Platforms
			NarutoPlatform.CFrame = newPart.CFrame
		else
			local newPart = Instance.new("Part")
			newPart.Anchored = true
			newPart.Transparency = 1
			newPart.Parent = workspace.Platforms.ReferenceParts
			newPart.Name = count
			
			local oldPartName = count - 1
			local oldPart = workspace.Platforms.ReferenceParts:FindFirstChild(oldPartName)
			local Y = oldPart.CFrame.Position.Y
			newPart.CFrame = CFrame.new(workspace.Platforms.FirstPart.CFrame.Position + Vector3.new(0,Y+40,0))
			
			local NarutoPlatform = workspace.Naruto.BossPlatform:Clone()
			NarutoPlatform.Parent = workspace.Platforms
			NarutoPlatform.CFrame = newPart.CFrame
		end
		
		
		
		if count ~= maxCount then
			count += 1
		else
			break
		end
		wait()
	end
end

local function clearPlatform()
	for i, part in pairs(workspace.Platforms:GetChildren()) do
		if part:IsA("MeshPart") and part.Name ~= "FirstPart" then
			part:Destroy()
		end
	end
	for i, part in pairs(workspace.Platforms.ReferenceParts:GetChildren()) do
		part:Destroy()
	end
end

createPlatform()

Appreciate any help!

What’s the difference in the code between the two videos? Are they working on the same code but with a different platform configuration?

Yes, both working on the same code. But it sometimes doesnt work.