Hi, I’ve been working on a simulator game and I can’t make it happen that when a player has no save, the starter tool will be inserted in the players backpack. This is the code I have now for loading the players tools:
local ss = game:GetService("ServerStorage")
local ds = game:GetService("DataStoreService")
local store = ds:GetDataStore("saveStore")
local library = ss:WaitForChild("Tools")
game.Players.PlayerAdded:Connect(function(player)
local ready = false
player.CharacterAdded:Connect(function(char)
local bp = player.Backpack
local data = nil
if ready == false then
ready = true
data = store:GetAsync(player.UserId)
if data then
setup(player, data)
edit(player, data)
end
else
local firstpc = game.ServerStorage.StarterTool["First Pc"] --problem here
local clone = firstpc:Clone()
clone.Parent = player.Backpack
end
The backpack saving and loading works perfectly fine but I don’t know how to give the tool to the player when he has no save yet