How do I make this script ONLY run if the player is on a certain team in the game such as "Chief"
local Opened = script.Parent.Opened
function Open(Part, Type)
if Opened.Value == false then
if game.Players:FindFirstChild(Part.Parent.Name) or game.Players:FindFirstChild(Part.Parent.Parent.Name) then
Opened.Value = true
for i = 0.1,5.4, 0.1 do
script.Parent.DoorLeft.CFrame = script.Parent.DoorLeft.CFrame * CFrame.new(0.1,0,0)
script.Parent.DoorRight.CFrame = script.Parent.DoorRight.CFrame * CFrame.new(-0.1,0,0)
wait()
end
wait(script.Parent.WaitTime.Value)
for i = 0.1,5.4, 0.1 do
script.Parent.DoorLeft.CFrame = script.Parent.DoorLeft.CFrame * CFrame.new(-0.1,0,0)
script.Parent.DoorRight.CFrame = script.Parent.DoorRight.CFrame * CFrame.new(0.1,0,0)
wait()
end
Opened.Value = false
end
end
end
script.Parent.Field1.Touched:connect(Open)
script.Parent.Field2.Touched:connect(Open)

1 comment
idk, but there is a member of Player called Team, which references the team object in game.Teams (a service btw)