Is the Position value of a part able to be used with CFrame.new?
local redBlock = game.Workspace["SLS Orion Cargo"].RedBlock
local blueCube = game.Workspace["SLS Orion Cargo"].BlueCube
script.Parent.OnServerEvent:Connect(function()
-- Create a Vector3 for both the start position and target position
local startPosition = Vector3.new(-1030.36, 1192.116, 97.92)
local targetPosition = blueCube.Position
-- Put the red block at 'startPosition' and point its front surface at 'targetPosition'
redBlock.CFrame = CFrame.new(startPosition, targetPosition)
end)
And is offsetting or what i put here the wrong thing?
I am brand new to this. so i do not know.
(I am keeping this open for anyone who has the same issue. position does work with CFrame.new.)
Putting two positions (the actual data type is called a Vector3) in the CFrame.new() constructor will result in a CFrame positioned at the first one and pointing at the second one.
If you only put one Vector3 in the constructor, it will create a CFrame at that position but with a default orientation.
But your answer is incorrect. Using two Vector3s to create a CFrame and point it in a certain direction is deprecated. According to the DevHub on that particular older CFrame constructor: “It remains for the sake of backward compatibility.”