What is wrong here? Im trying to make a gui appear when they have a gamepass?
game.Players.PlayerAdded:connect(function(plr) if game:GetService("MarketplaceService"):PlayerOwnsAsset(plr,408836915) then game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.Visible = true else game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.Visible = false end end)
Im not sure that ive dont this right but i checked the wiki.
Well... If you need to find a gamepass, use the GamepassService, not the MarketplaceService. MarketplaceService is mainly for checking if a user has a T-Shirt, Shirt, Pants, etc. It was an "improved" way of the old way of getting VIP. Anyways, here's a function I made to check if a player has a gamepass:
function HasPass(plr, id) return game:GetService("GamePassService"):PlayerHasPass(plr, id) end --Example code: if HasPass(game.Players.ReBorn110103, 408836915) then print("ReBorn110103 has gamepass ID 408836915) end
However, both ways can only be found with a ServerScript. If you use a LocalScript, the script will error and log out that PlayerHasPass cannot be used from the client.
So thanks for answering but I ReWrote it and it works
local clone = game.Workspace.ScreenGui:Clone() local id = 408836915 game.Players.PlayerAdded:connect(function(player) if game:GetService("GamePassService"):PlayerHasPass(player, id) then print("player has the gamepass :O") clone.Parent = player.PlayerGui else print("player doesn't have the gamepass :(") end end)