Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Part.Position is Confused. Why?

Hello. I was trying to make a part that follows the camera's x, y, and z position. Could you help me out? There's no error, it just doesn't work.

local owner = game.Players.iiDkOffical
local head = Instance.new("Part")
head.Name = "Head"
local group = Instance.new("Model")
group.Name = owner.Name.." - Game Time: "..elapsedTime()
head.Parent = group
head.Size = Vector3.new(1,1,1)
head.Position = Vector3.new(game:GetService("Workspace").CurrentCamera.CFrame)

1 answer

✓ Accepted answer

Position is a three-dimensional vector, to modify a userdata, you must cast the respective datatype to it. You casted a CFrame, which contradicts the datatype of Position. To ensure you're casting a proper Vector3 of CFrame, use the .p component which represents the Positional constant.

Part.Position = workspace.CurrentCamera.CFrame.p --// Returns a Vector3 automatically

This discussion is preserved as it was. New answers, comments, and votes are closed.