Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to know on wich side the player is?

Asked by 5 years ago

I know clearly how to open a door with a UI button, with a click detector i can use the TweenService to create a similar animation, But something that always got me wonder is how can i know on wich side is the player?, Like on this GIF, this script know on wich side the door got to open. I am kinda dull with all stuff that use CFrame, ive took some time to read the wiki again and again. Can someone help me with this subject? i dont want to remake the same door, i only need a "exemple" netheir a script already maked, only something to get me on the road of that subject.

local PlayerMagnitude = (Part.Position - Player.Character.HumanoidRootPart.Position).magnitude
0
You could check whether the X, Y, or Z values of one of the player's body part's position is greater or lower than the X, Y, or Z value of the door's main part. You would have to change this value for every door though. LawlR 182 — 5y
0
Alternatively, you could have two door handles on both sides of the door, and clicking one will open it one way, and clicking the other will open the door the other way. LawlR 182 — 5y
0
And how do i know if they are inferior or superior? NiniBlackJackQc 1562 — 5y
0
Why would you need to know that? LawlR 182 — 5y
0
Because I need to know everything NiniBlackJackQc 1562 — 5y

Answer this question