❓What Does it Do?
In donation games, when a player purchases a gamepass to donate Robux, the seller can change the price to other amounts than the original price after the purchase is prompted. Since the game detects the price after the prompt is closed, it falsely gets the modified amount.
Cases solves this issue by storing the original details of the gamepass before the purchase. When the purchase is completed, the game retrieves the correct amount rather than the modified price.
📝 What is a Case?
A case is a table that contains the gamepass details.
Additionally, a case profile is a container that stores all of the player’s cases.
📖 Documentation
:CreateCase
Creates a case for a player with the given Gamepass ID, returns the case if it succeeds.
CasesModule:CreateCase(player, "Gamepass", 12345678)
:CloseCase
Closes an existing case of a player with the given Gamepass ID.
CasesModule:CloseCase(player,12345678)
:GetPlayerCases
Returns all of the cases of a player.
CasesModule:GetPlayerCases(player)
:GetCase
Returns the case of a player from GamepassID. if the case exists, it returns the case. Else, returns nil.
CasesModule:GetCase(player,12345678)
:RemoveCaseProfile
Removes the case profile. Must be used when the player leaves.
CasesModule:RemoveCaseProfile(player)
💻 Example Code
local ServerStorage = game:GetService("ServerStorage")
local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local CasesModule = require(ServerStorage.CasesModule)
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Wait()
CasesModule:CreateCase(player, "Gamepass", 12345678)
MarketplaceService:PromptGamePassPurchase(player, 12345678)
end)
MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(player : Player, gamepassId, wasPurchased)
local theCase = CasesModule:GetCase(player, gamepassId)
if theCase~=nil then
print(theCase)
end
CasesModule:CloseCase(player, gamepassId) -- Close the case after getting it
end)
Players.PlayerRemoving:Connect(function(player)
CasesModule:RemoveCaseProfile(player) -- Remove the case profile when the player leaves (removes all of the cases)
end)