Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

I need Help on this script?

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)

1 comment

0

Code block please.

1 answer

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.