In My Game That I'm Working On I Have A Teleporter To A Pirate Ship That Has A Bunch Of Wandering NPC's.My Problem Is That The Go Through The Teleporter Into The Lobby And Annoy The People In The Lobby. Can Someone Help Me Make A Filtering System. (Also I Didn't Make The Teleport Part Of The Script)
local Teleport = "Lentilkac58-Easy-Teleport-2" --Put the name of the Part between the ""s.
function Touch(hit) --Indicates that the Part has been Touched.
if script.Parent.Locked == false and script.Parent.Parent:findFirstChild(Teleport).Locked == false then script.Parent.Locked = true script.Parent.Parent:findFirstChild(Teleport).Locked = true --Checks Debounce.
local Pos = script.Parent.Parent:findFirstChild(Teleport) --Gets the Part to teleport to.
hit.Parent:moveTo(Pos.Position) wait(1) script.Parent.Locked = false script.Parent.Parent:findFirstChild(Teleport).Locked = false end end --Takes you there and Ends the Function.
script.Parent.Touched:connect(Touch) --Listens out for Touchers.

4 comments
An easier way to do this is
if not game.Players:GetPlayerFromCharacter(hit.Parent) then print('not a player!') end^
That's going to give lots of false positives. Any time a part that is inside a character accessory is the 'hit' part, it's going to print("not a player!"). This is also a very expensive check to do on Touched, it loops over all the players. The fast way is to put NPCs into a table as keys when you create them, so you have an O(1) map of what is an NPC.
Didnt Work