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

Why does this not show the GUI?

Asked by
Spooce 78
9 years ago
local function WaitForChild(parent, childName)
    assert(parent, "ERROR: WaitForChild: parent is nil")
    while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end
    return parent[childName]
end
local GamePassService = game:GetService('GamePassService')
local PlayersService = game:GetService('Players')
local GamePassIdObject = WaitForChild(script, 'GamePassId')
local function OnPlayerAdded(player)
    if GamePassService:PlayerHasPass(player, GamePassIdObject.Value) then
        if player then
            local PlayerGui = WaitForChild(player, 'PlayerGui')
            local Gui = PlayerGui.SpecialEffectsGui
            Gui.FireButton.Visible = true
            Gui.SmokeButton.Visible = true
            Gui.SparklesButton.Visible = true
        end
    end
end
PlayersService.PlayerAdded:connect(OnPlayerAdded)

No error or warning, located in LocalScript via StarterGui.

Answer this question