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

Could someone tell me what I'm doing wrong in my script to make certain people have a GUI?

Asked by
Stadow 30
7 years ago
local CoolBoy = {
    3179316 ,31862508,
}

local Player = players.LocalPlayer
local Gui = Player.PlayerGui.SliderGui
local found = false

for i =1, #CoolBoy do
    if CoolBoy[i]== Player.UserId then
        Gui.Visible = true
        found = true
    else
        if not found then
               Gui.Visible = false
        end
    end
end

Notes: This is all in a LocalScript inside of StarterPlayer>StarterPlayerScripts, the GUI is called SliderGui and is in StarterGui. Alright thanks if you can help.

0
Try waiting for the PlayerGui; :WaitForChild("PlayerGui") MizeryGFX 15 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

is players defined? If it isn't, there's your problem.

Another thing that will probably help is replacing line 6 with:

local Gui = Player:WaitForChild("PlayerGui"):WaitForChild("SliderGui")
Ad

Answer this question