Here is the script:
local id = 749645444 game.Players.PlayerAdded:connect(function(player) if local HasPass = Game:GetService("GamePassService"):PlayerHasPass(player, id) then player:findFirstChild("PlayerGui").Teleport.Visible = true else player:findFirstChild("PlayerGui").Teleport.Visible = false local x = Instance.new("Message",Workspace) x.Text = player.Name .. (HasPass and " has" or " doesn't have").. " the game pass!" wait(2) x:Remove() end end)
How do I make this script indicate that a GUI will be given to the players if they bought a gamepass?
I have left some comments below.
local GamePassService = game:GetService("GamePassService") local id = 749645444 game.Players.PlayerAdded:Connect(function(Player) if GamePassService:PlayerHasPass(Player, id) then Player:FindFirstChild("PlayerGui").Teleport.Visible = true -- "findFirstChild" should be with a capital "F" else Player:FindFirstChild("PlayerGui").Teleport.Visible = false local x = Instance.new("Message",workspace) x.Text = Player.Name.. " does not have the game pass!" -- we don't need the "or" and "and" because, of course the player won't have it since it is in this else. wait(2) x:Destroy() --Destroying is better than removing end end)
If this helped, please be sure to accept my answer if this helped :)