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

Unable to cast CoordinateFrame to Vector3 help?

Asked by
Memotag 226 Moderation Voter
6 years ago

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:

01wait(1)
02model = game.ReplicatedStorage.Tycoon1
03floor = script.Parent.Floor
04backup = model:Clone()
05backup.Parent = game.Workspace
06wait(0.1)
07backup:MoveTo(CFrame.new(floor.Position))
08 
09function Regen()
10model:remove()
11wait(1)
12model = backup:clone()
13model.Parent = script.Parent 
14model:makeJoints()
15end
View all 25 lines...

Any help is appreciated!

0
clone and remove and makeJoints are deprecated use Clone Destroy and MakeJoints User#19524 175 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

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

Ad

Answer this question