Hi! I am new to CFrame functions and I am curious why my script doesn’t work as expected. My goal is to instance parts, which will respect my first’s part orientation.
Here is a video of my problem: robloxapp-20200425-1050487.wmv (1.8 MB)
--------- CREATING A PART -----------------------------
local firstPart = Instance.new("Part", game.Workspace.squere)
firstPart.Name = "First"
firstPart.Anchored = true
firstPart.Position = Vector3.new(10, 12, 30)
local Size = 64
firstPart.Size = Vector3.new(math.sqrt(Size), 1, math.sqrt(Size))
wait(15)
---------- CLONING PARTS ACCORDING TO FIRST PART -------------
for i = 1, math.sqrt(Size) - 1, 1 do
local clone = game.Workspace.squere.First:Clone()
clone.Name = "firstClone"
clone.Parent = game.Workspace.squere
clone.Color = Color3.fromRGB(math.random(1, 255), math.random(1, 255), math.random(1, 255))
clone.CFrame = clone.CFrame:ToObjectSpace(game.Workspace.squere.First.CFrame) * CFrame.new(math.sqrt(Size) * i, 0, 0) -- THIS LINE
end
Thanks for help!