Now with pictures!
About
Subscription Service is a module that utilises Developer Products to allow developers to create Subscriptions costing Robux rather than real currency, unlike Roblox’s built-in feature for subscriptions. In short, it is a good alternative to Roblox’s flawed built in Subscription feature.
Features
-
Easy Subscription Registration: Adding one/multiple subscriptions could not be made any easier.
-
Purchase Management: Grant and revoke subscriptions seamlessly to players in-game.
-
Expiration Handling: Automatically handle when a subscription has expired.
-
Flexible API: The module comes with a range of functions for whatever you may need.
-
Robux-Based: As most people on the platform do not want to pay real currency for game subscriptions, Robux based subscriptions will gain more profit.
-
Memory based: No objects are created, meaning that preformance is not affected.
Limitations
-
No Automatic Renewal: This is not possible to implement but this module could be worked around by prompting the player with a UI letting them know that their subscription expired
-
Potential Data Loss: As with anything that uses DataStoreService, if something at Roblox HQ goes down, data loss could occur. You are free to convert this module to more reliable data saving methods such as Datastore2
-
No Automatic Benefits: You will have to add the subscription benefits yourself, which means you will need a bit of scripting skill to use this module
Installation
Installation could really not be made any easier. (I am not the best explainer but I’ll try anyway) Simply follow the steps below:
-
Insert the module and put it in ServerStorage. You could get it HERE
-
Require it from a Script in ServerScriptService and adjust the settings as you wish.
local SubscriptionService = require(SubscriptionModuleObject)
SubscriptionService.Expiration_Check_Rate = 10 -- in seconds. how often players' subscriptions are checked for expiration ingame. default is 10 seconds.
SubscriptionService.Handle_Subscription_Purchases = true -- when true, if you prompt a player with the purchase of a subscription dev product, the module will handle it automatically.
SubscriptionService.Print_Credits = true -- do i even have to explain this
Now that the module is a part of the game, lets make some subscriptions!
Before you continue, make sure you know how to implement Developer Products. You could learn this from the Internet or read about it on the Developer Forum
- Create a table with all of the subscriptions you wish to add in sub-tables as such:
local ExistingSubscriptions = {
{
Name = "Test Subscription",
ProductId = 1679061197,
Duration = 7, -- In days
Stackable = true, -- When true, if a subscription is purchased while already having one, the player will get an additional however many days.
},
{
Name = "Test Subscription 2",
ProductId = 1679085149,
Duration = 30,
Stackable = false -- When false and a subscription is bought, a subscription will no be granted if the player already has one. you will have to prevent sale manually since there is not a way to do this.
}
}
- Now just simply use the
SubscriptionModule.RegisterSubscription(Subscription)
function of the module to register them!
for Index, Subscription in pairs(ExistingSubscriptions) do
SubscriptionService.RegisterSubscription(Subscription)
end
- Now the subscriptions are set up to use! You will have to add the benefits yourself using the functions provided by the module.
Sample Usage
Brief API Rundown
With Handle_Subscription_Purchases set to true, all you have to do for the subscription to register is to prompt the Player with the developer product using MarketPlaceService
and the module will handle everything else for you!
API Reference
API Reference will be in the module. Go read it.
Uncopylocked Place
Uncopylocked place to copy from can be found here
Special thanks to Road_Gamer2 for helping me out during the creation process of this module.
Any feedback, bug reports or suggestions will be greately appreciated and considered!!