Animate Text Overhead GUI

So I made Overhead GUI Textlabel that animate, based on team, I want to know what I do wrong
Code :

local Teams = game:GetService("Teams")
local label = script.Parent

game.Players.PlayerAdded:Connect(function(Player)
	local function Typewrite(String)
		for Count = 1, #String do
			label.Text = string.sub(String, 1, Count)
			task.wait(0.1)
		end
	end
	
	while true do
		if Player.Team == Teams["MCES"]  then
			Typewrite("Military Police")
			task.wait(3)
			Typewrite("SRT")
			task.wait(3)
		elseif Player.Team == Teams["Headquarters"] then
			Typewrite("Headquarters")
			task.wait(3)
			Typewrite("Chief Ranks")
			task.wait(3)
		else
			Typewrite("Unknown")
			task.wait(3)
			Typewrite("Coming Soon")
			task.wait(3)
		end
	end
end)

The thing is, my team is MCES, but my text label only show Unknown, and also the typewrite doesn’t work, may I know why? and how to solve it?

You’ve put this script inside a single TextLabel (line 2), yet you’re connecting a function which runs when any player is added (line 4). You’ll need to refactor your solution for this - I recommend putting a Script inside StarterCharacterScripts which inserts a BillboardGui. Although, I’m not entirely sure what you’re trying to make.

I use server script service, so how?

Then you’ll need to clone the premade BillboardGui every time the player spawns in. Again, this is a bit more complicated than just using StarterCharacterScripts, which inserts its contents into a player’s character each time they spawn.

Do you mind to look with studio? or something?

I also have another type using AnimateUI Module from Animate Text or Here is the code :

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)
	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

And my code works, but if i do not based on team :

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()

while true do

local message1 = [[Military Police]]

AnimateUI.typeWrite(label, message1, 0.05)

wait(3)

local message2 = [[Special Reaction Team]]

AnimateUI.typeWrite(label, message1, 0.05)

wait(3)

end

But if I make it based on team like :

local Player = 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()

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, message1, 0.05)

wait(3)

end

end

Suddenly doesn’t work, do you know why? I need the solution, really appreciate it.