I am trying to create a part that spawns on the side of another part, someone has told me to use CFrame:ToWorldSpace. I used it, and it worked fine when only placing one part. then, I tried adding a second. when I did the first part was placed correctly, the second part was in the wrong spot. I do not know why, here is the code:
local Part = script.Parent
local Pos = Part.CFrame
local Size = Part.Size
local Arrow = Instance.new("Part")
Arrow.Parent = script.Parent
local SizeX = Size.X * 1/2
Arrow.Anchored = true
local FinalPos = SizeX + 1
Arrow.CFrame = script.Parent.CFrame:ToWorldSpace(CFrame.new(FinalPos, 0, 0))
Arrow.Size = Vector3.new(0.5, 0.5, 0.5)
local Part = script.Parent
local Pos = Part.CFrame
local Size = Part.Size
local Arrow = Instance.new("Part")
Arrow.Parent = script.Parent
local SizeX = Size.X * 1/2
Arrow.Anchored = true
local FinalPos = SizeX - 1
Arrow.CFrame = script.Parent.CFrame:ToWorldSpace(CFrame.new(FinalPos, 0, 0))
Arrow.Size = Vector3.new(0.5, 0.5, 0.5)
anyone know why this does not work? thanks in advance, me7474.