I have a door whereas when a Player on the team Police touches the door, it will open. I have the opening script done, but for the game to check if the Player is on the Police team is failing. I have some code snippets for it
First, the Variables:
--Vaiables
local Sensor = script.Parent.Sensor
local Door = script.Parent["Prison Side Door 1"]
local Window = script.Parent.Window
local PlayerV = game.Workspace:FindFirstChild("Head")
local Light = script.Parent.Light
local Sensor = script.Parent.Sensor
local db = true
local Police = game:GetService("Teams"):FindFirstChild("Police")
Then the function that runs when the Sensor is touched:
--Function for everything
local function Everything(part)
local plr = game.Players:GetPlayerFromCharacter(part.Parent)
local hum = part.Parent:FindFirstChild("Humanoid")
print('found humanoid')
if hum then
local Player = part.Parent
local Character = workspace:WaitForChild(Player.Name)
local music = Instance.new("Sound",Character)
music.SoundId = "rbxassetid://993959716"
music.Name = "AMusic"
if db and Player.Team == Police then
db = false
music:Play()
Light.Color = Color3.fromRGB(0,255,0)
Door.Position = Vector3.new(-155.7, 105.225, -332.925)
Window.Position = Vector3.new(-155.65, 106.626, -332.925)
wait(4)
Door.Position = Vector3.new(-156.6, 105.225, -327.925)
Window.Position = Vector3.new(-156.6, 106.626, -327.925)
Light.Color = Color3.fromRGB(255,0,0)
db = true
else
warn("This Person is not a Police Team Person")
end
end
end
Finally, the connect function:
Sensor.Touched:Connect(Everything)
The Error it gives is on line 26 and it is:
17:33:39.710 - Team is not a valid member of Model
Any Ideas on how to fix this?

6 comments
I am going to see if the Police part should be in quotes
Nope, Does not work
question: what line in your 2nd script is line 26, I don't think a warn function would error "Team is not a valid member of Model"
Line 14
When you change teams, do you set neutral to false?
huh?