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

GUI hide script is not working as its supposed to and i dont know why?

Hi everyone first of all i made a GUI where you can choose ur loadout but i dont want the choosing team to have it so i made this prototype:

local Player = game.Players.LocalPlayer
local TB = game.StarterGui.ScreenGui.Menu

TB.Visible = false

if game.Player.TeamColor == BrickColor.new('Really blue') then
	TB.Visible = true
end

But even tho im in the really red team the button doesnt show up how could i fix this? I obviously made this inside a script and not a localscript

1 answer

"Player" is not a child, property, function, or event of game. I think you were trying to use your Player variable but just messed up.

Children of StarterGui is actually not what a player sees on their screen. StarterGui's children get cloned and parented under the newly joined player's PlayerGui, a special instance that actually shows what the player is seeing on their screen currently. Replace the TB variable to Player.PlayerGui.ScreenGui.Menu.

2 comments

0

you used LocalPlayer in a server script. LocalPlayer can only be used in a localscript

0

You need to Use LocalScript instead of Script. Script is Working on all Clients (Server) LocalScript is working on One Client (Player).

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