local JailSystemFolder = ReplicatedStorage:WaitForChild("JailSystem") local GetPrison = JailSystemFolder:WaitForChild("GetPrison") local GetPolice = JailSystemFolder:WaitForChild("GetPolice") local GetPrisonTeamName = GetPrison:InvokeServer() local GetPoliceTeamName = GetPolice:InvokeServer() if tostring(GetPlayer.Team) ~= GetPrisonTeamName and tostring(GetPlayer.Team) ~= GetPoliceTeamName then
part I am having trouble with is line 8
Don't use tostring
because it will error as it is a Team instance, not a number or string. Instead, get the Team's name by Team.Name
.
if GetPlayer.Team.Name ~= GetPrisonTeamName and GetPlayer.Team.Name ~= GetPoliceTeamName then
If you want it to be more specific, check if the Player's Team Color is the same as the target Team Color.
local PrisonTeamColor = Color.fromRGB(255, 0, 0) -- red local PoliceTeamColor = Color.fromRGB(0, 0, 255) -- blue if GetPlayer.TeamColor ~= PrisonTeamColor and GetPlayer.TeamColor ~= PoliceTeamColor then