But I am wanting the GUI to disappear if you own the Beta pass, which allows players to play the game itself.
local Players = game:GetService("Players")
local MarketPlaceService = game:GetService("MarketplaceService")
local GamepassId = 20328991
local Frame = script.Parent
Players.PlayerAdded:Connect(function(Player)
if (MarketPlaceService:PlayerOwnsAsset(Player, GamepassId)) then
Frame.Visible = false
end
end)
The script doesn’t work, can someone explain why it will not function properly?
You’re using PlayerOwnsAsset, when you should be using UserOwnsGamePassAsync
local Players = game:GetService("Players")
local MarketPlaceService = game:GetService("MarketplaceService")
local GamepassId = 20328991
local Frame = script.Parent
Players.PlayerAdded:Connect(function(Player)
if (MarketPlaceService:UserOwnsGamePassAsync(Player.UserId, GamepassId)) then
Frame.Visible = false
end
end)
local Players = game:GetService("Players")
local MarketPlaceService = game:GetService("MarketplaceService")
local GamepassId = 20328991
local Frame = script.Parent
Players.PlayerAdded:Connect(function(Player)
if MarketPlaceService:UserOwnsGamePassAsync(Player.UserId, GamepassId) then
Player.PlayerGui.ScreenGui.Frame.Visible = true
end
end)