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

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

Asked by 4 years ago

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

Log in to vote
0
Answered by 4 years ago

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.

Ad

Answer this question