GamepassLib v2 | Easy interface for gamepasses and devproducts

GamepassLib

Created by ScriptTops for free public domain use.
GamepassLib (GL)

Advantages of GL

GL does not require the user to reload the game to get the benefits of the gamepass,
GL is modular and uses OOP to handle gamepasses and devproducts,
and GL offers a easy to use Lib.

How to use GL

note: gl does offer more indepth documentation in the model

example gamepass

gamepassClass.new("Test", 10048580,{
	--called upon buying
	onBuy = function(player)
		print("Thx for buying")
	end,
	--called upon owner joining and when bought if chosen in options (on by default)
	onOwnerJoin = function(player)
		print("Thx for buying and coming back")
	end
	
	},
	{
		buyAndOwnerJoin = true
	})

example devproduct

	devProClass.new("Death", 999226473, function(player)
		player.Character.Humanoid.Health = 0
	end)

How to use GL Lib

GL Lib is integrated into the config module script, it contains four functions that will be useful when expanding the system. getGamepassById(int Id), getGamepassByName(string Name), getDevproductById(int Id), and getDevproductByName(string Name). they do exactly as they say but if needed documentation can be found in the freemodel

Where can I get GL

to install just drag the folder to ServerScriptService
https://www.roblox.com/library/5155876992/GamepassLib legacy

26 Likes

I can see that this works when a player buys a gamepads and I honestly think its very neat and clean interface which appears easy to use, However how does It work in relation to a player joining a game who already owns the gamepass, maybe the ability to add a bool allowing us to enable / disable if that function will be called if a player joins with the gamepass would be useful.

2 Likes

Thank you for the suggestion and your comments! I’ll be sure to add that.

1 Like

Update 1.1

-added option (true by default) to fire the onPurchase function when the owner of the gamepass joins. Suggestion by: LuaBearyGood

1 Like

If you were looking for further ways to expand this system, adding dev product support would be a useful step towards making it an all in one solution to easy payment system setups. Maybe being able to do module.DevProducts = {} would be the best way to attempt this.

1 Like

I’ll probably do a complete rewrite to add support for everything marketplaceservice offers. I made this as part of a commission I’m doing, it’s a simulator so alot of devproducts. I’ll probably just make a highly custom one, I wanted to share this as I love helping people and I could see this being useful.

1 Like

Will use this in the future! Thanks!

Update 2

  • added support for devproducts
  • completely rewrote the gamepass system
  • updated GL Lib to include devproducts
  • integrated GL Lib into config
  • Included built-in documentation

I’ll be updating the post soon

How on earth do you put more than one gamepass In?? I can’t figure it out for the life of me right now.

use a comma between the entries, it’s just a list bro

When I do PromptProductPurchase and the player buys it, it wont execute the callback function in the config.

may I have an example??
30chars

Thanks for making this, I definitely will use this in the future, anyway thanks again🙂

nvm i figured it out lol. was actually simple.

Quite confused lol, how do i set this up to actually give users a tool when buying a gamepass. :upside_down_face: feel stupid LOL