Group CFrame error

Been using a tycoon kit (AlvinBlox 2024 kit). It should copy the CFrame of the grouped buttons using PivotTo, but isn’t working properly.

This is the code segment

		for _, Button in TemplateButtons:GetChildren() do
			if table.find(itemIdsTable, Button:GetAttribute('IdOfItemToUnlock')) then
				continue 
			end
			-- Get the pos of the button relative to the template plot
			-- How far away is button from the centre of the template plot (20,30)
			local RelativeCFrame = TemplatePlot.CFrame:ToWorldSpace(Button.CFrame)
			Button:PivotTo(plot:ToWorldSpace(RelativeCFrame))
		
			if Button:GetAttribute('Hidden') then
				Button.Transparency = 1
				Button.BillboardGui.Enabled = false
				Button.CanCollide = false
			end

Error is saying that "CFrame is not a valid member of Model “Buttons.ConveyorButton” on line 92 local RelativeCFrame = TemplatePlot.CFrame:ToWorldSpace(Button.CFrame))

I don’t have any idea as to why it isn’t working.

A model doesn’t have a Cframe. Do GetPivot() instead

Unsure how or where I would put it, it keeps erroring.

Instead of .CFrame → :GetPivot()

1 Like