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)
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)