Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how do i make a tool permanent in inventory using scripts?

Asked by 5 years ago
Edited 5 years ago

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)
0
Can you post the script you made that puts tools in your starter pack when you buy them? MegaManSam1 207 — 5y
0
edited the post, check it out. PicoTheRiko 34 — 5y
0
Use DataStores, Heres an example https://devforum.roblox.com/t/datastore-inventory/65759 MusicalDisplay 173 — 5y
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. Phantom1996 45 — 5y

Answer this question