Animating Text Label For Overhead GUI

I want to make text label typewriter effect for Overhead GUI, It’s work if not based on team, but if I use based on team, it doesn’t work. This is my code now, that work without based on team and the one that doesn’t work if i make based on team. I use AnimateUI Module. The module is on below or you can see AnimateUI

AnimateUI Module (Replicated Storage) :

local LocalizationService = game:GetService("LocalizationService")
local Players = game:GetService("Players")

local SOURCE_LOCALE = "en"
local translator = nil

local AnimateUI = {}

function AnimateUI.loadTranslator()
	pcall(function()
		translator = LocalizationService:GetTranslatorForPlayerAsync(Players.LocalPlayer)
	end)
	if not translator then
		pcall(function()
			translator = LocalizationService:GetTranslatorForLocaleAsync(SOURCE_LOCALE)
		end)
	end
end

function AnimateUI.typeWrite(guiObject, text, delayBetweenChars)
	guiObject.Visible = true
	guiObject.AutoLocalize = false
	local displayText = text

	-- Translate text if possible
	if translator then
		displayText = translator:Translate(guiObject, text)
	end

	-- Replace line break tags so grapheme loop will not miss those characters
	displayText = displayText:gsub("<br%s*/>", "\n")
	displayText:gsub("<[^<>]->", "")

	-- Set translated/modified text on parent
	guiObject.Text = displayText

	local index = 0
	for first, last in utf8.graphemes(displayText) do
		index = index + 1
		guiObject.MaxVisibleGraphemes = index
		wait(delayBetweenChars)
	end
end

return AnimateUI

This is my code:
Code 1 (Work Without Based on Team)

local Teams = game:GetService("Teams")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local AnimateUI = require(ReplicatedStorage:WaitForChild("AnimateUI"))
local label = script.Parent
local player = game:GetService("Players")


AnimateUI.loadTranslator()

while true do
		local message1 = [[Military Police]]
		AnimateUI.typeWrite(label, message1, 0.05)

		wait(3)

		local message2 = [[Special Reaction Team]]
		AnimateUI.typeWrite(label, message2, 0.05)
		wait(3)
end

This is Code 2 (Doesn’t work)(Using Based on team)

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local AnimateUI = require(ReplicatedStorage:WaitForChild("AnimateUI"))
local label = script.Parent
local Teams = game:GetService("Teams")

-- Load translator if game is localized
AnimateUI.loadTranslator()

local player = game:GetService("Players")

while true do
	if player.Team == Teams["Military Police"] then
		local message1 = [[Military Police]]
		AnimateUI.typeWrite(label, message1, 0.05)

		wait(3)

		local message2 = [[Special Reaction Team]]
		AnimateUI.typeWrite(label, message2, 0.05)

		wait(3)	
	end
end

I want to make it work, based on team, so different team has different animating text message, please, I need the solution. Thanks.
Note : I try to use local player = label:FindFirstAncestorWhichIsA("Player") , still doesn’t work

local Players = game:GetService("Players")
local Teams = game:GetService("Teams")
local Storage = game:GetService("ReplicatedStorage")
local Module = Storage:WaitForChild("AnimateUI")
local AnimateUI = require(Module)
local label = script.Parent

AnimateUI.loadTranslator()

Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		if Player.Team == Teams:FindFirstChild("Military Police") then
			while Character do
				local message1 = [[Military Police]]
				AnimateUI.typeWrite(label, message1, 0.05)
				task.wait(3)
			end
		elseif Player.Team == Teams:FindFirstChild("Special Reaction Team") then
			while Character do
				local message2 = [[Special Reaction Team]]
				AnimateUI.typeWrite(label, message2, 0.05)
				task.wait(3)
			end
		end
	end)
end)