What is wrong with my script?

  1. What do you want to achieve?
    I have no idea what is wrong with my script. I am trying to make a team chooser gui when a player joins the game. The gui won’t even pop up. Here is my script in server script service:
local function onPlayerJoin(player)
game.StarterGui.TeamChooser.Team1.Visible = true

I then repeat for the other two buttons. Next is the:

  1. What is the issue? the script will not work. Should it be a local?

  2. What solutions have you tried so far? I have tried making the script do the same thing but turning the screen gui.Enabled to true as well.
    Oh, btw I forgot to tell you, I defined players too.

local Players = game:GetService(“Players”)

You should be manipulating gui objects from the client, and also to get the specific element you need to get it from the player’s gui and also add a WaitForChild since the gui elements may no be fully loaded in at runtime.

--in a local script do
local Player = game.Players.LocalPlayer
local PlayerGui = Player:WaitForChild("PlayerGui")

PlayerGui:WaitForChild("TeamChoose"):WaitForChild("Team1").Visible = true

Oh, wait. One thing. I don’t add the gui into player gui do I?

No all the elements placed in StarterGui will get added to the PlayerGui

Oh, that makes sense. Thanks so much!

1 Like