Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
-- This code should be in a 'Script' object within 'ServerScriptService' local MarketplaceService = game:GetService("MarketplaceService") local boughtLifeEvent = game.ReplicatedStorage.DiedEvents.boughtLifeEvent local reviveEvent2 = game.ReplicatedStorage.DiedEvents.reviveEvent2 local reviveEvent3 = game.ReplicatedStorage.DiedEvents.reviveEvent3 local RoleItems = game.ServerStorage.RoleItems local function processReceipt(receiptInfo) -- Find the player who made the purchase in the server local player = game:GetService("Players"):GetPlayerByUserId(receiptInfo.PlayerId) if player then -- Output what product they bought print(player.Name .. " just bought " .. receiptInfo.ProductId) boughtLifeEvent:FireClient(player) -- IMPORTANT: Tell Roblox that the game successfully handled the purchase return Enum.ProductPurchaseDecision.PurchaseGranted end end -- Set the callback (this can only be done once by one script on the server!) MarketplaceService.ProcessReceipt = processReceipt reviveEvent2.OnServerEvent:Connect(function(player) player:LoadCharacter() if (player) and (player.Backpack) then for _, Item in pairs(player.Backpack:GetChildren()) do if Item:IsA("Tool") then Item:Destroy() end end end RoleItems.Bat:Clone().Parent = player.Backpack RoleItems.Medkit:Clone().Parent = player.Backpack end) reviveEvent3.OnServerEvent:Connect(function(player) player:LoadCharacter() if (player) and (player.Backpack) then for _, Item in pairs(player.Backpack:GetChildren()) do if Item:IsA("Tool") then Item:Destroy() end end end RoleItems.Bat:Clone().Parent = player.Backpack end)
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)