Yes, it is possible to treat a part as an origin position and then check where the player is in comparison to the part. To do this, you can use the “CFrame” property of a part and the “Character” and “HumanoidRootPart” properties of a player. Then, you can calculate the player’s relative position to the part using the subtraction operation of “CFrames”.
Here is an example code:
local part = script.Parent
local player = game.Players.LocalPlayer
local relativePosition = player.Character.HumanoidRootPart.CFrame - part.CFrame
print(relativePosition)
This code takes the position of the part (part) as the origin and then calculates the relative position of the player’s HumanoidRootPart (player.Character.HumanoidRootPart) in comparison to the part
That’s a CFrame which contains both positional and rotational data (rotation is made of 3 directional vectors which make up a matrix). Think what you’d need from that is the position (so instead of print(cf), do print(cf.Position), or just read the first 3 numbers)
You don’t really need to know about matrices and stuff to work with CFrames, you can get the rotation from a CFrame by using CFrame:ToOrientation to get each axis of rotation in radians (which can be converted to degrees with math.deg, then back to radians through math.rad)
Also if you only need the position from the translated CFrame, it might be more performant to use CFrame:PointToObjectSpace() since it doesn’t have to take into account the “goal” result’s orientation but I might be wrong.