So I’m working on a little side thing just to get back into the swings of things, as I haven’t coded somthing in a while, and I’m trying to use CFrame more often (Since I think It’ll be a good habit)
I’m working on something that will duplicate parts and arrange them in a circle.
Code
local Centerlocation = Vector3.new(0,10,0)
local Circlesize = 10
local PartAmount = 36
local ClonePart = game.Workspace.Part
for count = 1, PartAmount do
local Timeslooped = 1
local CopiedPart = ClonePart:Clone()
CopiedPart.Parent = game.Workspace
CopiedPart.Anchored = true
CopiedPart.CFrame = CFrame * CFrame.Angles(math.rad(0),0,0)
CopiedPart.CFrame = CFrame.new(0,10,0) + CopiedPart.CFrame.RightVector * Circlesize
Timeslooped = Timeslooped + 1
end
However, it repeatedly keeps telling me that on line 14, it expected CFrame, but instead got a table.
Line 14: CopiedPart.CFrame = CFrame * CFrame.Angles(math.rad(0),0,0)
Can anyone help me with this?
Edit: The error was in the fact that I used CFrame instead of CopiedPart.CFrame, my bad
in the statement on line 14 just using CFrame instead of CFrame.new() or CopiedPart.CFrame is a table, or more specifically a metatable defined by roblox. In a object oriented sense you are trying to multiply the blueprint for an object but not an actual object.