I’m writing billboard gui overhead text with typewriting effect.
It works if I don’t base on team
If I only use
local player = game:GetService("Players")
local Teams = game:GetService("Teams")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local AnimateUI = require(ReplicatedStorage:WaitForChild("AnimateUI"))
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, message2, 0.05)
wait(3)
end
It works but without based on team
But if i make like this
local player = game:GetService("Players")
local Teams = game:GetService("Teams")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local AnimateUI = require(ReplicatedStorage:WaitForChild("AnimateUI"))
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, message2, 0.05)
wait(3)
end
or
if player.Team == Teams[“Military Police”] then
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
end
It doesn’t work the textlabel doesn’t show anything
This is my full script that works (without based on team), but I want to make it based on team that works
AnimateUI Module Script
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
Or you can see from Animating Text
Can anyone help me so it can be based on team? like if player.Team == Teams[“abcd”] , Thanks.
NOTE : This is for Overhead GUI Billboard, and the animation script is Children of the textlabel that’s why I use script.Parent