New: Nitro Boost our Discord server and receive full donation perks here on the website! Join the Scripting Helpers Discord Server to learn more! You can also Support on Patreon as always.
Still have questions? Join our Discord server and get real time help.
Log in to vote

Part.Position is Confused. Why?

Asked by 14 days ago

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 ="Part")
head.Name = "Head"
local group ="Model")
group.Name = owner.Name.." - Game Time: "..elapsedTime()
head.Parent = group
head.Size =,1,1)
head.Position ="Workspace").CurrentCamera.CFrame)

1 answer

Log in to vote
Answered by
Feahren 3662 Moderation Voter Community Moderator
14 days ago
Edited 14 days ago

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

Answer this question