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

Why does this output error occur?

Asked by
Avectus 120
9 years ago

I'm trying to make the model 'Jericho 1' move as a whole (since there's more than one brick in the model) so I've set the Primary Part to Warhead1. Anytime I press the button, all I get is an output error saying "Unable to cast double to CoordinateFrame".

Jericho1 = game.Workspace["Jericho I"]
 Jericho2 = game.Workspace["Jericho 2"]

Warhead1 = Jericho1.Warhead
Warhead2 = Jericho2.Warhead

Jericho1.PrimaryPart = Warhead1
Jericho2.PrimaryPart = Warhead2



 function onClicked(playerWhoClicked)
   for i = 1, 500 do
    Jericho1:SetPrimaryPartCFrame(-31.209+i, 3.451, -126.11)

end
end

script.Parent.ClickDetector.MouseClick:connect(onClicked)

Could someone please tell me why this error occurs and/or what I need to do to fix it?

Thanks.

1 answer

Log in to vote
0
Answered by
MrNicNac 855 Moderation Voter
9 years ago

The function sees that as three separate numbers. You need to give it one CFrame.

Jericho1:SetPrimaryPartCFrame(CFrame.new(-31.209+i, 3.451, -126.11))
0
Fixed it. Thanks! Avectus 120 — 9y
Ad

Answer this question