Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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)

2 comments

0

Where's the script?

0

This is just to make it invisible.

This discussion is preserved as it was. New answers, comments, and votes are closed.