Hi! So I have a script I paid someone to make and I cant seem to understand how it works since my scripting knowledge is limited to Variables, Functions, Values and Moving Objects.
How it works
So, when someone purchases a gamepass, this script gives it to the player whenever they click the purchase option again.
The Script
local GamePassManager = {}
local MarketPlace = game:GetService(“MarketplaceService”)
local function CheckPass(Player, GamePass)
if MarketPlace:UserOwnsGamePassAsync(Player.UserId, GamePass) then
return true
else
return false
end
end
function GamePassManager.GivePassPort(Player)
local Passport = game.ReplicatedStorage.PassPort:Clone()
Passport.Name = Player.Name…“'s Passport”
Passport.Parent = Player.Backpack
end
function GamePassManager.GetGamePass(GamePass, Player)
pcall(function()
MarketPlace:PromptGamePassPurchase(Player, GamePass)
end)
MarketPlace.PromptGamePassPurchaseFinished:Wait()
local bool = CheckPass(Player, GamePass)
if bool == false then
return false
elseif bool == true then
return true
end
end
return GamePassManager
Script pt 2
local remote = game.ReplicatedStorage.Prompt
local GamePassManager = require(game.ServerStorage.GamePassManager)
remote.OnServerEvent:Connect(function(Player, PassId)
local bool = GamePassManager.GetGamePass(PassId, Player)
if bool == true then
GamePassManager.GivePassPort(Player)
end
end)
What i want to know
I have many other gamepasses I wish to use so I need to know how I can use these scripts multiple times to work for other gamepasses by giving an item upon purchase
NOTE
The tool it gives is stored in replicated storage.
Please comment if you have a solution!