Hello.
I'm not an experienced scripter at all, so forgive me if this is easy. I need some help on door opening. What I want to happen is when a character (aka robloxian) gets close to a door, they open automatically. I want the doors to open like automatic doors.
If anyone could help me with this it would be great!
Thanks.
There are 2 methods you can do for this.
You can do a magnitude check. The formula for getting the distance for the parts is as follows.
local Vec = Position1 - Position2 local Distance = math.sqrt(Vec.x^2,Vec.y^2,Vec.z^2) local Distance = Vec.magnitude -- alternative.
Vector3 values has a .magnitude property so you could just use Vec.magnitude as well. This would require constant checking so be wary of that. Doing this client-sided if possible would work.
The 2nd method is putting an invisible part in front of the door then hooking a .Touched event to it that triggers the door.