Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Unable to cast CoordinateFrame to Vector3 help?

The idea of the script is to clone a model from 'ReplicatedStorage', take it to the Workspace and then place it in the same position as a baseplate. Right now the script will do everything as explained but it will also output the error ' Unable to cast CoordinateFrame to Vector3' and I have no idea on how to fix it.

Here is the code:

wait(1)
model = game.ReplicatedStorage.Tycoon1
floor = script.Parent.Floor
backup = model:Clone()
backup.Parent = game.Workspace
wait(0.1)
backup:MoveTo(CFrame.new(floor.Position))

function Regen() 
model:remove()
wait(1) 
model = backup:clone() 
model.Parent = script.Parent  
model:makeJoints() 
end

while true do 
wait(1.5) 
if backup.Main.Owner.Value ~= "" then 
if not game.Players:FindFirstChild(backup.Main.Owner.Value) then 
Regen() 

end 
end 
end 

Any help is appreciated!

1 comment

0

clone and remove and makeJoints are deprecated use Clone Destroy and MakeJoints

1 answer

On line 7, you're trying to use MoveTo() with a CFrame inside.

Unfortunately, MoveTo only accepts an argument of Vector3, so it's firing that error.

To get a Vector3 from a CFrame simply add a .p like such: CFrame.new(floor.Position).p

This discussion is preserved as it was. New answers, comments, and votes are closed.