Hello, I am trying to make it so that when a player enters the team screen it would update the wait for players label. Example: Waiting for players 1/8, while on the team screen, another player joins the team screen . Waiting for players 2/8 etc and also when they leave the team screen they are kicked and the label updates to, Waiting for players 1/8.
I am currently trying a remote event but for some reason it is not working. Also I don't know if this should be client to server or server to client.
Client script:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local teamEvent = ReplicatedStorage:WaitForChild("teamEvent")
local Players = game:GetService('Players')
local LocalPlayer = Players.LocalPlayer
local PlayerGui = LocalPlayer:WaitForChild('PlayerGui')
local teamScreen = LocalPlayer.PlayerGui.ScreenGui.mFrame.ArenaFrame.ArenaOFrame.TeamFrame
local ScreenGui = PlayerGui:WaitForChild('ScreenGui')
local TeamScreen = ScreenGui:WaitForChild('mFrame'):WaitForChild('ArenaFrame'):WaitForChild('ArenaOFrame'):WaitForChild('TeamFrame')
local StatusLabel = ScreenGui:WaitForChild('mFrame'):WaitForChild('ArenaFrame'):WaitForChild('ArenaOFrame'):WaitForChild('TeamFrame'):WaitForChild('StatusLable')
local redFrame = ScreenGui:WaitForChild('mFrame'):WaitForChild('ArenaFrame'):WaitForChild('ArenaOFrame'):WaitForChild('TeamFrame'):WaitForChild('redFrame')
local blueFrame = ScreenGui:WaitForChild('mFrame'):WaitForChild('ArenaFrame'):WaitForChild('ArenaOFrame'):WaitForChild('TeamFrame'):WaitForChild('blueFrame')
teamEvent:FireServer()
Server script:
local PlayerRequirement = 8
local Players = game:GetService('Players')
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local teamEvent = Instance.new("RemoteEvent", ReplicatedStorage)
teamEvent.Name = "teamEvent"
local LocalPlayers = Players.LocalPlayer
StatusLabel = script.Parent.Parent.StarterGui.ScreenGui.mFrame.ArenaFrame.ArenaOFrame.TeamFrame.StatusLable
local function UpdateStatusLabel()
local NumPlayers = #Players:GetPlayers()
if NumPlayers < PlayerRequirement then
StatusLabel.Text = 'Waiting for players (' .. NumPlayers .. '/' .. PlayerRequirement .. ')'
else
wait(1)
StatusLabel.Text = 'Game Start!'
end
end
if StatusLabel.Visible == false then
Players.PlayerRemoving:Connect(UpdateStatusLabel)
elseif StatusLabel.Visible == true then
Players.PlayerAdded:Connect(UpdateStatusLabel)
end
teamEvent.OnServerEvent:Connect(UpdateStatusLabel)
UpdateStatusLabel()
If i could get some help with this that would be great!

2 comments
hmm..that did not seem to work the label did not change it just said Label when I got into the game
Did you get any errors? (View -> Output)