Ok so I’m trying to make it so when you have purchased a gamepass a TextButton becomes visible. Now I’ve gotten it to work but here’s where I need help.
The script I have works when I use it when not in a group game (so a game made on a roblox account)
But as you can assume it doesn’t work for group games for some reason.
I own the gamepass I’m using to test it and it is set correctly but it just won’t work.
Script:
local GamepassId = 51455122
local frameToShow = script.Parent
local player = game.Players.LocalPlayer
repeat wait() until player.Character
local PlayerGui = player:WaitForChild("PlayerGui"):WaitForChild("ScreenGui")
local MarketplaceService = game:GetService("MarketplaceService")
if MarketplaceService:UserOwnsGamePassAsync(player.UserId, GamepassId) then
frameToShow.Visible = true
end
So this script is in a Local Script in the TextButton that is the textbutton that is supposed to show but doesn’t.
game.Players.PlayerAdded:Connect(function()
if MarketplaceService:UserOwnsGamePassAsync(player.UserId, GamepassId) then
frameToShow.Visible = true
end
end
local plr = game.Players.LocalPlayer
local mps = game:GetService("MarketplaceService")
local frameToShow = script.Parent
if mps:UserOwnsGamePassAsync(plr.UserId, 17921189) then
frameToShow.Visible = true
else
frameToShow.Visible = false
end
I have tried this, and it works.
If this isn’t what you are talking about, try enabling third part sales in your game settings.
local Game = game
local Script = script
local Players = Game:GetService("Players")
local Player = Players.LocalPlayer
local MarketplaceService = Game:GetService("MarketplaceService")
local Frame = Script.Parent
local GamePassId = 17921189
local Success, Result = pcall(function() return MarketplaceService:UserOwnsGamePassAsync(Player.UserId, GamePassId) end)
Frame.Visible = Result