Can anyone help how to make this code into based on team? (This is animated typewrite for my overhead billboard textlabel):
If i make like this , without based on team, it works:
local label = script.Parent
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
Typewrite("Military Police")
task.wait(3)
Typewrite("SRT")
task.wait(3)
end
But once I try to make it based on team, it doesn’t work, please solution for this?
This is the code that doesn’t work, I want to make it work based on team :
local label = script.Parent
local Player = game:GetService("Players")
local Teams = game:GetService("Teams")
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["Military Police"] then
Typewrite("Military Police")
task.wait(3)
Typewrite("SRT")
task.wait(3)
end
end
**
NOTE : I use Normal Script (Server Script Service)
Yes, use game:GetService('Players'):GetPlayers() and run a loop through each player in the table. Then you have the needed Player variable you want for your function.
local label = script.Parent
local Player = game:GetService("Players")
local Teams = game:GetService("Teams")
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
for _, player in pairs(Player:GetPlayers()) do
if player.Team == Teams["Military Police"] then
Typewrite("Military Police")
task.wait(3)
Typewrite("SRT")
task.wait(3)
end
end
end