Hello, how do I fix this error Unable to cat Vector3 to CoordinateFrame? It's on line 29.
local Players = game:GetService("Players");
local InsertService = game:GetService("InsertService");
local Cars = {5083437873, 5083676767}
Players.PlayerAdded:Connect(function(player)
while true do
local character = player.Character or player.CharacterAdded:Wait()--waits for the character if not already loaded
local HumanoidRootPart = character:WaitForChild("HumanoidRootPart")
local carId = Cars[math.random(1, #Cars)];
local root = InsertService:LoadAsset(carId);
local instances = root:GetChildren()
if #instances == 0 then
root:Destroy()
return
end
root = root:GetChildren()
if #root == 1 then
root = root[1]
else return end
print(root)
root.Body.Drive.Disabled = false
root.Parent = workspace
root:SetPrimaryPartCFrame(HumanoidRootPart.Position)
end
end)

1 comment
Vector3 ~= CFrame. Cast a CFrame.