How can i detect if Teams are existing in my game

Hello,
I want to detect if my game has Teams, but its not working!
i hope Someone can helps me.

local Rollen = {}

script.Parent.ProximityPrompt.Triggered:Connect(function(player)
	print(game.Teams:GetTeams())
	if game.Teams:GetTeams() == {} then
		warn("Keine Team's Gefunden!")
	else
		if table.find(Rollen, player.Team.Name) == true then
			script.Parent:Sit(player.Character:FindFirstChild("Humanoid"))
		elseif Rollen == nil then
			script.Parent:Sit(player.Character:FindFirstChild("Humanoid"))
		end
	end
end)

Thank you for the Help!

Never ever ever {} == {} will be true.
Just check for the amount of keys (#):

#GetTeams() == 0 then
2 Likes

i dont check this thing with “keys (#)”

Well do it, because it’ll work. No loops.

1 Like

First thing, please use :GetService("Teams") !! game:GetService([InsertServiceName]) will always be the best option for a myriad of reasons.
Second thing, all you have to do is:

if #game:GetService("Teams"):GetTeams() == 0 then
...
end

Mariogg also brings up something to know for the future, {} == {} will never be true, so don’t rely on it.

2 Likes

grafik
i dont check it, im Very sorry! :neutral_face:

It’s okay, I think you forgot to add the “if” in front.

Omg… im so stupid… ok thank you!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.