So I working on creating NPC's for my game using custom GUI's (not the default roblox chat boxes), but I don't know how to detect if a player walks too far away from the NPC while talking to them? Is there a way to do this easily?
I think so, using .magnitude. Basically you would subtract the NPCs position from the players position, giving you a vector3. Then use .magnitude on the vector3 and it will give you the absolute distance from the NPC like this
local Distance = (Character.HumanoidRootPart.Position-NPC.HumanoidRootPart.Position).magnitude
Sorry if it doesn't work, you can comment the error if you want