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

how do i move a model with this code? (cframe)

i believe script.parent.parent means its the model the location is:game<workspace<pully<meshpart<script heres the script and error message

function pull_up_then_down()
	script.parent.parent:SetPrimaryPartCFrame(CFrame == Vector3.new(-28.688, 9.34, -25.841))
end
script.Parent.ClickDetector.MouseClick:Connect(pull_up_then_down)

20:21:10.204 - Unable to cast bool to CoordinateFrame

1 answer

✓ Accepted answer

Hello. The problem is that you used Vector3 on a CFrame. Also, when setting a CFrame, you mustn't use CFrame = Vector3.new(X, Y Z) as it's just not how it works, and you cannot set a value of a Roblox global. Try this:

local function pull_up_then_down()
	script.Parent.Parent:SetPrimaryPartCFrame(CFrame.new(-28.688, 9.34, -25.841))
end

script.Parent.ClickDetector.MouseClick:Connect(pull_up_then_down)

Please accept and upvote this answer if it helped.

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