Does anyone know how to make a script which is like this:
A script in a part but its not always active, when its active it allows only people who are in a certain team in and if someone from a different team enters, they get teleported to a teleport part
local team = game.Teams["Team Name"]
local teleport_location = workspace["Name of location brick"].Position
script.Parent.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player and player.Team == team then
hit.Parent:MoveTo(teleport_location)
end
end)