So I need help with making a script that will use 'datastore' to save guns that people have bought from the gun gui shop but I cant figure it out. I have similar code that uses 'datastore' to save stats like money. ~~~~~~~~~~~~~~~~~
--[[local DSService = game:GetService('DataStoreService'):GetDataStore('Protectiveroboz')
game.Players.PlayerAdded:connect(function(plr)
--Define varibles
local uniquekey='id'..plr.userId
local leaderstats = Instance.new('IntValue',plr)
local savevalue = Instance.new('IntValue')
leaderstats.Name = 'leaderstats'
savevalue.Parent = leaderstats
savevalue.Name = 'Points'
-- GetAsync
local GetSaved = DSService:GetAsync(uniquekey)
if GetSaved then
savevalue.Value = GetSaved[1]
else
local NumbersForSaving = {savevalue.Value}
DSService:SetAsync(uniquekey,NumbersForSaving)
end
end)
game.Players.PlayerRemoving:connect(function(plr)
local uniquekey = 'id-'..plr.userId
local Savetable = {plr.leaderstats.Points.Value}
DSService:SetAsync(uniquekey, Savetable)
end)]]~~~~~~~~~~~~~~~~~
Thats the code but does anyone know how to change it to save weapons?

1 comment
Well, you have to create a table that saves the names of the tools, then when they rejoin, find the tool's name in wherever it is and give it to them