Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Setup
- local PurchaseFunctions = {};
- --[[
- Function: GiveCash
- Description: Give a specified amount of cash when purchased
- Option: Amount of cash to give
- Function: GiveMaxHealth
- Description: Raises max health
- Option: Amount of health to be added on top of the 100.
- Function: GiveSpeed
- Description: Increases walkspeed
- Option: Amount of speed to add onto base speed (16)
- Function: GiveGear
- Description: Puts a gear into player's backpack
- Option: Name of the gear
- Option2: Put true if it saves when you die, false if it's only for one life.
- --]]
- -- Tip: Changing 'Name' doesn't do anything, it's just for organizational purposes.
- local Gamepasses = {
- { Name="Give #TeamJD Sign Permanently"; ID=546372998; Function="GiveGear"; Option="#TeamJDSign"; Option2=true; };
- { Name="Give JD Knife Permanently"; ID=546373770; Function="GiveGear"; Option="JDKnife"; Option2=true; };
- { Name="Give JD Gun Permanently"; ID=546373570; Function="GiveGear"; Option="JDGun"; Option2=true; };
- { Name="Give Radio Permanently"; ID=546205764; Function="GiveGear"; Option="Radio"; Option2=true; };
- { Name="Give Cloud Permanently"; ID=546371214; Function="GiveGear"; Option="Cloud"; Option2=true; };
- { Name="Give Hoverboard Permanently"; ID=546369593; Function="GiveGear"; Option="Hoverboard"; Option2=true; };
- };
- local DeveloperProducts = {
- { Name="Give Teddy Temporarily"; ID=43414443; Function="GiveGear"; Option="Teddy"; Option2=false; }; -- Don't forget this symbol ;
- { Name="Give RAIG TABLE!!! Temporarily"; ID=43386695; Function="GiveGear"; Option="RAIGTABLE!!!"; Option2=false; };
- { Name="Give Firefly Jar Temporarily"; ID=43414837; Function="GiveGear"; Option="FireflyJar"; Option2=false; };
- { Name="Give Fireworks Temporarily"; ID=43414903; Function="GiveGear"; Option="Fireworks"; Option2=false; };
- { Name="Give Hot Chocolate Temporarily"; ID=43415111; Function="GiveGear"; Option="HotChocolate"; Option2=false; };
- { Name="Give Smore Temporarily"; ID=43415135; Function="GiveGear"; Option="Smore"; Option2=false; };
- };
- -- Tip: 'Username' is not used, it's just to keep track of who you're giving passes to because UserIDs are hard to remember!
- -- Tip: You can use this to test the gamepasses without buying or even making them, the ID can be fake and it'll still work.
- local FreePasses = {
- { Username="Player1"; UserID=-1; Passes={ 546372998,546373770,546373570,546205764,546371214,546369593,43414443,43386695,43414837,43414903,43415111,43415135 }; };
- { Username="Nikilis"; UserID=4242824; Passes={ 546372998,546373770,546373570,546205764,546371214,546369593,43414443,43386695,43414837,43414903,43415111,43415135 }; };
- }
- -- Nothing below to edit
- local MarketplaceService = game:GetService("MarketplaceService")
- local Keys = {};
- function MarketplaceService.ProcessReceipt(ReceiptInfo)
- local playerProductKey = ReceiptInfo.PlayerId .. ":" .. ReceiptInfo.PurchaseId
- if Keys[playerProductKey] then return Enum.ProductPurchaseDecision.PurchaseGranted; end
- local Player = game:GetService("Players"):GetPlayerByUserId(ReceiptInfo.PlayerId)
- if not Player then return Enum.ProductPurchaseDecision.NotProcessedYet; end
- for _,ProductData in pairs(DeveloperProducts) do
- if ProductData.ID == ReceiptInfo.ProductId then
- PurchaseFunctions[ProductData.Function](Player,ProductData.Option,ProductData.Option2);
- Keys[playerProductKey] = true;
- return Enum.ProductPurchaseDecision.PurchaseGranted
- end
- end
- return Enum.ProductPurchaseDecision.NotProcessedYet
- end
- local MaxHealths = {};
- local Speeds = {};
- PurchaseFunctions.GiveCash = function( Target, Option )
- game.ServerStorage.MoneyStorage[Target.Name].Value = game.ServerStorage.MoneyStorage[Target.Name].Value + Option;
- end
- PurchaseFunctions.GiveMaxHealth = function( Target, Option )
- MaxHealths[Target] = (MaxHealths[Target] and MaxHealths[Target]+Option) or Option;
- Target.Character.Humanoid.MaxHealth = 100 + MaxHealths[Target];
- end
- PurchaseFunctions.GiveSpeed = function( Target, Option )
- Speeds[Target] = (Speeds[Target] and Speeds[Target]+Option) or Option;
- Target.Character.Humanoid.WalkSpeed = 16 + Speeds[Target];
- end
- PurchaseFunctions.GiveGear = function( Target, Gear, Permanent )
- game.ServerStorage.Gear[Gear]:Clone().Parent = Target.Backpack;
- if Permanent then
- game.ServerStorage.Gear[Gear]:Clone().Parent = Target.StarterGear;
- end
- end
- local function Debug(Player,Function,Option,Option2)
- PurchaseFunctions[Function](Player,Option,Option2);
- end
- local Debugger = Instance.new("RemoteEvent")
- Debugger.Name = "PurchaseDebugger";
- Debugger.Parent = game.ReplicatedStorage;
- MarketplaceService.PromptPurchaseFinished:connect(function(Player, AssetID, IsPurchased)
- if IsPurchased then
- for _,GamepassData in pairs(Gamepasses) do
- if AssetID == GamepassData.ID then
- PurchaseFunctions[GamepassData.Function](Player,GamepassData.Option,GamepassData.Option2);
- end;
- end;
- end
- end)
- game.ReplicatedStorage.BuyDP.OnServerEvent:connect(function(Player,ID)
- MarketplaceService:PromptProductPurchase(Player,ID);
- end)
- game.ReplicatedStorage.BuyGP.OnServerEvent:connect(function(Player,ID)
- MarketplaceService:PromptPurchase(Player,ID);
- end)
- game.Players.PlayerAdded:connect(function(Player)
- Player.CharacterAdded:connect(function(Character)
- Character:WaitForChild("Humanoid").MaxHealth = 100 + (MaxHealths[Player] or 0);
- Character:WaitForChild("Humanoid").WalkSpeed = 16 + (Speeds[Player] or 0);
- end)
- repeat wait(); until Player.Character~=nil and game.ServerStorage.MoneyStorage:FindFirstChild(Player.Name);
- for _,GamepassData in pairs(Gamepasses) do
- local HasFreePass = false;
- for _,PD in pairs(FreePasses) do
- if PD.UserID == Player.userId then
- for _,ID in pairs(PD.Passes) do
- if ID == GamepassData.ID then
- HasFreePass = true;
- end
- end
- end;
- end
- if HasFreePass or MarketplaceService:PlayerOwnsAsset(Player,GamepassData.ID) then
- PurchaseFunctions[GamepassData.Function](Player,GamepassData.Option,GamepassData.Option2);
- end
- end;
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement