Hello Developers,
I’m working on a Dutch Roleplay Game! I want to make a GamePass called “Earbuds” that I’m going to sell.
I want if you don’t have the GamePass, this is what it says you can buy…
https://gyazo.com/a4632381cb3e5f0178a5d12c575ed19f
And if you have the GamePass that the Frame is gone and you can use it! I hope somebody can help me!
Greetings,
Sys. (Aka. Tim)
2 Likes
Hmm, maybe check if the player has the gamepass via MarketPlaceService , and set the frame’s visibility to FALSE if they have it.
TIP: Theese kinds of problems can be easier to solve / make if you turn it into an algorithm. It really helped me during my first stages when I started scripting!
You mean the reverse MarketPlaceService with GUIs?
I don’t get what your saying but, just use;
UserOwnsGamePassAsync
to check if the player has the gamepass, then set the frame’s visibility to false.
Check out this MarketplaceService | Documentation - Roblox Creator Hub for more information.
I can’t quite figure it out. Do you have a script for me that I can use?
-- [ variables ] --
local mps = game:GetService("MarketplaceService")
local id = 1 -- gamepass id goes here
local frame = -- location of the gui's frame --
-- [ code ] --
local function PlayerHasPass()
if mps:UserOwnsGamePassAsync(id) then
frame.Visible = false
end
mps:UserOwnsGamePassAsync:Connect(PlayerHassPass)
Not sure this will work, I’m running out of time. So, try to get help from someone else if needed, sorry!
Thanks for your help!
Is this a localscript or a script?
Normal script, if it doesn’t work, try a localscript.
Thanks for your help! I go try it, when it is working i will set you on “Solution”!
It is not working… I try a LocalScript and a Script! But the BuyButton and Frame (The Overlay) dont will be invisible.
Alright, here’s a script that should work.
-- [ variables ] --
local mps = game:GetService("MarketPlaceService ")
local frame = -- frame location
local gamepass = -- gamepass id
local id = game.Players.LocalPlayer.UserId
local plrhasgp = mps:UserOwnsGamePassAsync(id, gamepass)
-- [ script ] --
if plrhasgp then
frame.Visible = false
end
Edited my reply, should be working now.
Also, insert it into a localscript, if it doesn’t work, try a normal script.
Yes, it works! Thank you so much for your help!
No problemo! airsoft561 Studios will always be here for you if you ever need help again!
1 Like
Okay, thanks! Maybe can you add me on Discord?
My disc is:
Systerni#7777
I don’t use discord, sorry. I do have a roblox group.
What’s the issue? Can you tell me? I need more info then just an image.