I have a menu team creation gui, it all works mostly except for a part that is meant to, when a button is clicked, remove a player from the team they are in, and update the gui so that they are no longer in the team on the screen. This all works, for all the players except for the player that clicks the button, they’re ui doesn’t update like the rest of the players and for that player, they still see themselves in that team in the gui. Anyone know why?
(this isn’t the full script, just the part that does this)
local function PlayerLeaveTeam(player)
warn(player.Name .. " has left " .. player.Team.Name)
local CurTeamUI = Menu:FindFirstChild(player.Team.Name)
if CurTeamUI:FindFirstChild("Username 1").Text == player.Name then
CurTeamUI:FindFirstChild("Username 1").Text = CurTeamUI:FindFirstChild("Username 2").Text
CurTeamUI:FindFirstChild("Username 2").Text = CurTeamUI:FindFirstChild("Username 3").Text
CurTeamUI:FindFirstChild("Username 3").Text = ""
elseif CurTeamUI:FindFirstChild("Username 2").Text == player.Name then
CurTeamUI:FindFirstChild("Username 2").Text = CurTeamUI:FindFirstChild("Username 3").Text
CurTeamUI:FindFirstChild("Username 3").Text = ""
elseif CurTeamUI:FindFirstChild("Username 3").Text == player.Name then
CurTeamUI:FindFirstChild("Username 3").Text = ""
end
if CurTeamUI:FindFirstChild("Username 1").Text == "" then
CurTeamUI.Visible = false
end
player.Team = game.Teams:FindFirstChild("Hunters")
end
PLT.OnServerEvent:Connect(PlayerLeaveTeam)