Unable to cast Coordinate Frame to Vector3
The error is on line 22, what is the problem?
01 | local FPD = false -- First Part Down, tells the script when the first section has been placed. |
02 |
03 | local parentHere = workspace.RoomFolder |
04 | local cells = game.ReplicatedStorage:GetChildren() |
05 | for i, v in pairs (cells) do |
06 | v.PrimaryPart = v.Start |
07 | end |
08 | for y = 1 , 4 , 1 do |
09 | local cell = cells [ math.random(#cells) ] :clone() |
10 | cell.Parent = parentHere |
11 |
12 | if FPD = = true then |
13 | local pos = script.NextPosition.Value |
14 | cell:MoveTo(pos) |
15 | script.NextPosition.Value = cell.Finish.CFrame |
NextPosition is a Vector3Value object, you're trying to assign a CFrame value to its Value
property.
Assign it a Vector3 value and it will work fine. You can grab the position of a CFrame as a Vector3 value using its p
component: cell.Finish.CFrame.p
.