hello, I decided to continue making the game, but unfortunately I have a lot of knowledge in the IT sphere, I don’t have a mistake here
ServerScriptService.LastEquipped:27: attempt to index nil with 'Clone' - Server - LastEquipped:27
here is the script itself
local dsService = game:GetService("DataStoreService")
local ds = dsService:GetDataStore("LastEquippedShop11")
game.ReplicatedStorage.GameClient.Events.RemoteEvent.PlayerLoaded.OnServerEvent:Connect(function(player)
local equippedlast = Instance.new("StringValue")
equippedlast.Name = "Equipped"
local save = ds:GetAsync(player.UserId)
if save then
equippedlast.Value = save
else
local name
for i, tool in pairs(game.ServerStorage.Tools:GetChildren()) do
if tool:FindFirstChild("ItemNumber") then
if tool.ItemNumber.Value == 1 then
name = tool.Name
end
end
end
equippedlast.Value = name
end
equippedlast.Parent = player
local clone = game.ServerStorage.Tools:FindFirstChild(equippedlast.Value):Clone(0)
clone.Parent = player:WaitForChild("Backpack")
end)
game.Players.PlayerRemoving:Connect(function(player)
ds:SetAsync(player.UserId, player.Equipped.Value)
end)

3 comments
Try removing the "0" from the parentheses
I edited my answer. Just for a notification incase you did not know.
I edited my answer again. Just for a notification incase you did not know.