Even with "UPD" in the title, things go wrong. Here is your repair checklist.
Spawn the broken dupe in a clean, flat, empty map (like flatgrass). Observe the console (press ~). Look for red errors: gmod acf car dupe upd
Creating the Duplication Functionality:
Updating Parameters:
Example Code Snippet: A very simplified example of how you might start with duplicating a vehicle: Even with "UPD" in the title, things go wrong
-- Assuming acfVehicle is the table representing your ACF vehicle
function DeepCopy(tbl, seen)
if seen == nil then seen = {} end
local copy = {}
for k, v in pairs(tbl) do
seen[k] = seen[k] or {}
if type(v) == "table" then
copy[k] = DeepCopy(v, seen[k])
else
copy[k] = v
end
end
return copy
end
function DuplicateVehicle(vehicle)
local vehicleData = vehicle:GetTable()
local duplicatedData = DeepCopy(vehicleData)
-- Use ACF's API to create a new vehicle with duplicatedData
-- This part heavily depends on ACF's API and is omitted for brevity
end
Testing and Iteration: