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

0

Can you post the script you made that puts tools in your starter pack when you buy them?

0

edited the post, check it out.

0
0

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.