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

Why will this check the playgui? [SOLVED]

Asked by 10 years ago
local player = game.Players.LocalPlayer

if game.Workspace.Battle.Value == true then 
    player:WaitForChild("PlayerGui").Header.Text.Visible = false 
    for i,v in pairs(player:WaitForChild("PlayerGui").Main:GetChildren()) do
        if v:IsA("GuiObject") then
            v.Visible = true
        end
    end
end

when I start a 2 player server it dosent make the visibilty to them change

0
Can you edit your post and go into a bit more detail? Do you mean each object's children or the object itself? Spongocardo 1991 — 10y
0
Well all I really want is to just want the header.text visigble = false and the mains children visible = true, but it dosent work, I have even tried game.StarterGui.Header.Text.Visible = false and even that dosent work NinjoOnline 1146 — 10y
0
Don't use game.StarterGui, you have to use the player's PlayerGui. Spongocardo 1991 — 10y

1 answer

Log in to vote
0
Answered by 10 years ago

Put this in a Local Script inside StarterGui.

local player = game.Players.LocalPlayer

player:WaitForChild("PlayerGui").Header.Text.Visible = false --Make the Text object in Header invisible.
for i,v in pairs(player:WaitForChild("PlayerGui").Main:GetChildren()) do --Gets all children in the Main gui in the player's PlayerGui.
    if v:IsA("GuiObject") then --If the child is a Gui Object then
        v.Visible = true --Make the child visible.
    end
end
0
dosent work, ive editted my answer NinjoOnline 1146 — 10y
0
and it is in local and in startergui NinjoOnline 1146 — 10y
Ad

Answer this question