function Active(Touched)
if Touched.Parent:FindFirstChild("Humanoid") then      ----== game.Teams.Cops then
	local Plr = game.Players:GetPlayerFromCharacter(Touched.Parent.Humanoid)
	if Plr.Team == game.Teams.Cops then
	script.Parent.OpenDoor:Fire()
	
else
	if script.Parent.Deny.IsPlaying == false then script.Parent.Deny:Play() end
end
end
end
script.Parent.Touched:connect(Active)

When I try it, it dosen't work. I get an error:

`11:17:53.237 - Workspace.YardDoor.Sensor.Main:4: attempt to index local 'Plr' (a nil value)

11:17:53.239 - Stack Begin

11:17:53.240 - Script 'Workspace.YardDoor.Sensor.Main', Line 4

11:17:53.241 - Stack End`

2 comments

1

You are using GetPlayerFromCharacter with the humanoid instead of the actual character, instead of Touched.Parent.Humanoid use Touched.Parent

0

Thank you! Solved!