Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Unable to cast Vector3 to CoordinateFrame?

Asked by 4 years ago

Hello, how do I fix this error Unable to cat Vector3 to CoordinateFrame? It's on line 29.

01local Players = game:GetService("Players");
02local InsertService = game:GetService("InsertService");
03 
04local Cars = {5083437873, 5083676767}
05 
06Players.PlayerAdded:Connect(function(player)
07    while true do
08            local character  = player.Character or player.CharacterAdded:Wait()--waits for the character if not already loaded
09 
10    local HumanoidRootPart = character:WaitForChild("HumanoidRootPart")
11 
12    local carId = Cars[math.random(1, #Cars)];
13    local root = InsertService:LoadAsset(carId);
14 
15      local instances = root:GetChildren()
View all 31 lines...
0
Vector3 ~= CFrame. Cast a CFrame. Ziffixture 6913 — 4y

1 answer

Log in to vote
1
Answered by
blazar04 281 Moderation Voter
4 years ago

You are getting this error because you are trying to set root's primary part CFrame and HumanoidRootPart.Position is not a CFrame–it is a Vector3 coordinate. Instead use HumanoidRootPart.CFrame

Ad

Answer this question