i want to make an iftouched thats basically an "escape"
script:
**local CollectionService = game:GetService("CollectionService")
local teams = game:GetService("Teams")
local Player = game:GetService("Players")
script.Parent.Touched:Connect(function(hit)
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
if plr.Team == game.Teams:WaitForChild("Prisoner") then
plr.Team = game.Teams:WaitForChild("Criminal")
elseif plr.Team.Name == "Criminal" then
CollectionService:AddTag(plr,"Guilty")
end
end)**
error:
Workspace.MapElements.Arrestability Thing.Script:8: attempt to index nil with 'Team' - Server - Script:8
help please!