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

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

Asked by 3 years ago

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

Log in to vote
0
Answered by 3 years ago

"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.

0
you used LocalPlayer in a server script. LocalPlayer can only be used in a localscript 6wz3 0 — 3y
0
You need to Use LocalScript instead of Script. Script is Working on all Clients (Server) LocalScript is working on One Client (Player). RektwayYTB 123 — 3y
Ad

Answer this question