What am I doing wrong here? The commented line is what I was trying to do as it would move the whole model. However, I get an error that says "Unable to cast double to CoordinateFrame"
What this is supposed to do is if the y position is greater then 20 then it will bring the model down to a y of 10
local PrimaryPart = script.Parent.PrimaryPart local Model = script.Parent while true do wait() if PrimaryPart.Position.Y > 20 then PrimaryPart.Position = Vector3.new(PrimaryPart.Position.X, 10, PrimaryPart.Position.Z) -- Doesn't move the whole model --Model:SetPrimaryPartCFrame(PrimaryPart.Position.X, 10, PrimaryPart.Position.Z) end end
You did everything right, you just forgot a few things. If you want to use a Vector3 to move the entire model, use:
model:MoveTo(Vector3.new(0,0,0))
If you want to position the model using a CFrame, you did it right except you're trying to make the CFrame out of 3 numbers, when you should be making it out of a Vector3. Just change it so there's a Vector3.new() around the 3 numbers inside the CFrame.new for your model:SetPrimaryPartCFrame