Help play animation through server

So, I’ve made a script that checks for players’ teams from a table, But is there a way to check specifically for values that are set to true?

local table = {
	["Team1"] = true,
	["Team2"] = false
}

for i, v in pairs(game.Players:GetChildren()) do
	game.Workspace.Part.ProximityPrompt.Triggered:Connect(function(plr)
		if table.find(table, plr.Team.Name) then
			print("Player team is set to true...")
		else
			print("Player team is set to false...")
		end
	end)
end

I assume the tables name is only for the code example, as making variables with the same names as existing globals is probably not very good.
Also, Aren’t you doing what are you are describing in

		if table.find(table, plr.Team.Name) then
			print("Player team is set to true...")
		else
			print("Player team is set to false...")
		end
```?

Apparently, when I run my script the game, it doesn’t find the true instances, it prints Player team is set to false... in any case.

You’ve overwritten the global variable named ‘table’.

local table = {
	["Team1"] = true,
	["Team2"] = false
}

Rename this variable.

2 Likes