Can I use table.find to find a specific team?

table.find() requires the first parameter to be a table and the second parameter to be an element (instance). It returns the index of the element if found, and you can just use that to find the respective team and its properties. Also GetPlayers() is a table, so you need to loop through it to reference the player. Oh and also Humanoid:LoadAnimation is deprecated, so you consider using Animator:LoadAnimation instead.

So in this case, you don’t need the for loop.

local teams = game:GetService("Teams")
local teamName = script.Parent.Parent.TextBox2.Text

script.Parent.TextButton.MouseButton1Click:Connect(function()
	local id = script.Parent.Parent.TextBox.Text
	script.Parent.Animation.AnimationId = id
	wait(1)
	local index = table.find(teams:GetTeams(), teams:FindFirstChild(teamName))
	if index then
		local team = teams:GetTeams()[index]
		for _, plrs in pairs(team:GetPlayers()) do
			local char = plrs.Character or plrs.CharacterAdded:Wait()
            local humanoid = char:WaitForChild("Humanoid")
		    local animationTrack = humanoid:LoadAnimation(script.Parent.Animation)
	    	animationTrack:Play()
		end
	end
end)