How do I make a revive button that costs robux and saves items?

So, im trying to make it so a button on my death screen costs robux and saves your items once you respawn. Here’s my script for now.


you probably need to return some values in the remoteevent, like a table containing all of the tools they had, so you can give them back to you

i would do something like

local ReplicatedStorage = game:GetSerivce("ReplicatedStorage")
local MainEvent = ReplicatedStorage:FindFirstChild("MainEvent")

MainEvent.OnServerEvent:Connet(function(plrFired: Player, Subject: string, ...: any)
if not Player then
   return -- returns if player is not spawned

local Argument = {...} -- sets the arguments into table

if Subject == "RespawnDeathProduct" then
        local Items = Argument[1] -- this is where the tools/items is basically the backpack
        local ItemstoSave = {]
        table.insert(ItemsToSave, Items) --- inserts the items in the table

        plrFired:LoadCharacter() --- loads the character

                for i, v in pairs (ItemstoSave) do -- checks for the tools
                     if v ~= nil and v:IsA("Tool") then
                          v.Parent = plrFired.Backpack -- redirects the items into the players backpack
              ItemstoSave = {} -- resets the table once the player respawned

sorry for the late reply, i had this in my drafts and never finished it. i’m pretty sure what happened was that it made the button come up with prompt and when you buy it, nothing happened.