Unable to cast Coordinate Frame to Vector3
The error is on line 22, what is the problem?
local FPD = false -- First Part Down, tells the script when the first section has been placed. local parentHere = workspace.RoomFolder local cells = game.ReplicatedStorage:GetChildren() for i, v in pairs(cells) do v.PrimaryPart = v.Start end for y = 1, 4, 1 do local cell = cells[math.random(#cells)]:clone() cell.Parent = parentHere if FPD == true then local pos = script.NextPosition.Value cell:MoveTo(pos) script.NextPosition.Value = cell.Finish.CFrame end if FPD == false then local pos = workspace.RoomFolder.Begin.Finish.CFrame cell:MoveTo(pos) FPD = true script.NextPosition.Value = cell.Finish.CFrame end wait(1) end
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
.