Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How do I make my script close a team switch GUI once the player has chose the team?

Asked by 4 years ago

I am trying to make a switch team script and I am at the last part where I have to get the script to go invisible but it seems wherever I put the last part of code it doesn't work.

Script:

game.StarterGui.TeamSwitchGui.MainFrame.Visible = true
local TC = Instance.new("RemoteEvent")
TC.Name = "TeamChanger"
TC.Parent = game.ReplicatedStorage

TC.OnServerEvent:Connect(function(Player, TeamName)
    Player.Team = game.Teams[TeamName]
    game.StarterGui.TeamSwitchGui.MainFrame.Visible = false -----Part that is not working
    Player:LoadCharacter()
end)

Please help.

1 answer

Log in to vote
1
Answered by
SirGamezy 186
4 years ago
Edited 4 years ago

You have to access the player's PlayerGui. You cannot edit what the players see with StarterGui. So, this should work:

TC.OnServerEvent:Connect(function(player, teamName)
    player.PlayerGui.TeamChangeGUI.Enabled = false
end)
0
Where's the script? ConorG234 39 — 4y
0
This is just to make it invisible. SirGamezy 186 — 4y
Ad

Answer this question