Correct way to check If game creator owns a certain gamepass

So recently I’ve been working on some scripts to include on my models to check if the game creator owns the specified gamepass Id.

I’m not very fluent in lua, so I’d like to ask for advice or any correct way to do this.

Script:

local id = 7835985

if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(game.CreatorId, id) then
-- Script
else
script:Destroy()
end

Thanks

4 Likes

Are you trying to make it so it detects if you own a game pass?

2 Likes

Here is my version of your script:

local id = 7835985
if game:GetService(“MarketplaceService”):UserOwnsGamePassAsync(game.Players.LocalPlayer.UserId, id) then
else
script:Destroy()
end

Let me know if it worked for you :slight_smile:

1 Like

The script is supposed to detect if the game creator (not localplayer) owns the given gamepass

Couldn’t you just make it so you own the game pass only?

2 Likes

I think you can make the Gamepass as a Dev Product.

2 Likes

This was mainly created for my tech group which normally requires the game creator/developer to purchase the given gamepass in order for the model to function

Where’s your script located? In StarterGui?

1 Like

It’s a module, In my current code It should set It’s parent to ServerScriptService.

I prefer it being a gamepass as it’s something needing to be bought once.

Oh, I thought it was a LocalScript in StarterGui. Not sure if something along the longs of this will work:

local id = 7835985 –

if game.Players.LocalPlayer.Name == “Scxipted” and game:GetService(“MarketplaceService”):UserOwnsGamePassAsync(script.Parent.UserId, id) then
– script
else
script:Destroy()
end

This might work as a localscript

2 Likes

Also, why would you want to know if the game’s creator owns a game pass? Do you plan on making something like CheckMeIn?

1 Like

I’m attempting to make it so it can be fairly difficult to be leaked, Instead of leaking all the scripts I’ve placed it in a module but I’m attempting to achieve the module running only if the game creator owns the certain gamepass provided, CheckMeIn could be a good example of what I’m attempting to achieve.

No matter what you do, people can always work around the check for the gamepass. (And get the source code) Just something to consider before jumping into a project.

3 Likes

Are you trying to make it so you can get special items in-game such as tools?

I’m trying to achieve more of a product that works if the game creator that added my product owns the given gamepass

I’m just very confused :thinking:

Are you familiar with the tech industry on roblox?

I’ll say no, since I’ve never heard of that.

Well, the script does work but I believe there is room for improvements.