I’ve been trying to clone a car I have, but when I do, the car falls through the map. I’m guessing it’s not cloning properties correctly? This is because when I loop and set Anchored and CanCollide = True for all parts, the car no longer falls through the ground but it is no longer drivable.
My next guess other than properties is that the welding isn’t cloned properly. When I check if everything (from the original model) under the cloned model is in the directory, it’s all there.
I’m thinking maybe I could write a script to deep copy the car but that could be a lot more work than needed to fix this problem. Any thoughts/advice?
Here is the cloning script I wrote.
wait(8)
local middlePart = script.Parent.middlePart
originalPosition = Vector3.new(-556.331, 63.074, -324.058)
while true do
wait(10)
if originalPosition ~= middlePart.Position then
print("Not Equal")
newCar = workspace.knockCar:Clone()
newCar.Parent = workspace
newCar.Name = "newCar"
newCar.PrimaryPart = newCar.middlePart
for _, part in pairs(newCar:GetDescendants()) do
if part:IsA("BasePart") then
part.Anchored = true
part.CanCollide = true
end
end
newCar:SetPrimaryPartCFrame(CFrame.new(originalPosition))
end
end