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

Why does this output error occur?

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

✓ Accepted answer

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))

1 comment

0

Fixed it. Thanks!

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