i made a shop where you buy a tool and it puts it in your backpack. i was making a script where if you die, none of your tools dissapear. i tried making a script where if you buy a tool, it goes in your starterpack. but that does not work. any help? script that puts tools in my backpack:
script.Parent.MouseButton1Click:connect(function()
local replicated = game:GetService("ReplicatedStorage")
local item = replicated:WaitForChild("Trophy")
local price = 1
local player = game.Players.LocalPlayer
local stats = player:WaitForChild("leaderstats")
if stats.Points.Value >= price then
stats.Points.Value = stats.Points.Value - price
local clone = item:Clone()
clone.Parent = player.Backpack
end
end)

4 comments
Can you post the script you made that puts tools in your starter pack when you buy them?
edited the post, check it out.
Use DataStores, Heres an example https://devforum.roblox.com/t/datastore-inventory/65759
DataStores works if you want this inventory to be kept between games, but for just between lives you can just save a table of the weapons the player currently has and give them back at respawn.