I’m trying to test out my knowledge of CFrames, I’m currently playing around with this demo I made that only half works. It consists of 3 parts, two of them grouped in a model. The two parts in the model are supposed to teleport to the third part, which is outside of the model. For some reason, the code doesn’t return any errors, but neither of the two parts in the model change their position.
Code:
(Script is placed in the workspace):
local Model = game.Workspace.Cell
local PPart = game.Workspace.Part
local ModelChildren = Model:GetChildren()
local PrimaryPart = Model.Primary
for _, Children in pairs(ModelChildren) do
local ChildPosition = Children.CFrame
local PPartCFrame = CFrame.new(PPart.Position.X, PPart.Position.Y, PPart.Position.Z)
print(PPartCFrame)
--local Difference = CFrame.new(ChildPosition.X + PrimaryPart.CFrame.X, ChildPosition.Y + PrimaryPart.CFrame.Y, ChildPosition.Z + PrimaryPart.CFrame.Z)
ChildPosition = CFrame.new(PPart.Position.X, PPart.Position.Y, PPart.Position.Z)
end
Any help or suggestions are greatly appreciated!