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

PrimaryPartCFrame not working?

Asked by
JJ_B 250 Moderation Voter
8 years ago

I made a button that moves a model when it is clicked. The script is eternally simple and I can't understand why it isn't working. I get the error Unable to cast double to CoordinateFrame Here is the script:

script.Parent.ClickDetector.MouseClick:connect(function()
    script.Parent.Parent:SetPrimaryPartCFrame(10,0,10)
end)

Help please.

1 answer

Log in to vote
2
Answered by 8 years ago

You made a simple mistake. You tossed in 10,0,10 but you need it to be CFrame.new(10,0,10).

SetPrimaryPartCFrame needs two things. First you MUST have a PrimaryPart for the model before you try to use SetPrimaryPartCFrame and also, in the parenthesis, you need a CFrame value!

0
Thanks, totally forgot about the CFrame.new! JJ_B 250 — 8y
0
No problem, I do mistakes similar to that, here and there. alphawolvess 1784 — 8y
Ad

Answer this question