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

I need Help on this script?

Asked by 10 years ago

I don't why this won't work. what did i do wrong? It's suppose to make the gui visible for players that have gamepass

game.player.ChildAdded:connect(function(player) if (Game:GetService("GamePassService"):PlayerHasPass(newPlayer,157704758)) then player.PlayerGui.Battlegrounds.Frame.VIP.Visible = true else player.PlayerGui.Battlegrounds.Frame.VIP.Visible = false end end)

0
Code block please. Ekkoh 635 — 10y

1 answer

Log in to vote
0
Answered by
Ekkoh 635 Moderation Voter
10 years ago

It's game.Players, not game.player. I'd also use PlayerAdded, not ChildAdded.

-- make a variable for GPS
local GPS = Game:GetService("GamePassService")
Game:GetService("Players").PlayerAdded:connect(function(plr)
    if GPS:PlayerHasPass(plr, 157704758) then
        plr:WaitForChild("PlayerGui").ChildAdded:connect(function(ch)
            if ch.Name == "Battlegrounds" then
                ch:WaitForChild("Frame"):WaitForChild("VIP").Visible = true
            end
        end)
    end
end)
Ad

Answer this question