So I am creating code that places a part right in front of the players character, so I did this:
local targetCframe = root.CFrame * CFrame.new(0,0,-1)
local targetPo = targetCframe.Position
In theory this should work, but instead it puts it right next to the default spawnpad.
So I eventually tried this:
function getPO2(distance,char)
local part = Instance.new('Part') -- the reason we make a part is cause other wise it will act weird
local po = char.PrimaryPart.CFrame * CFrame.new(Vector3.new(0,0,distance))
part.CFrame = po
local po2 = part.Position
part:Destroy()
return po2
end
so the part in this code is just a placeholder, and when I set its CFrame to the cframe I’ve created and then get the parts position, well it works.
So why is it that when I get the position from the CFrame, its different from the parts position.
Its really strange as they should be the same position, but its not, setting the parts CFrame to the created CFrame and then getting its position gives us the right position that I wanted, whereas without doing it, it gives us the wrong position.
Anyhow I would like to figure this out cause creating a part every time I want to do this is a little annoying, so why does this happen?