My inventory code is in serverscriptservice, but the if statement is underlined red, but I don't know what is wrong, I tried, doing then and else after the if statement. I put some * around the if
print("Hello world!") local dataStoreService = game:GetService("DataStoreService") local dataStore = dataStoreService:GetDataStore("BackpackSave") game.Players.PlayerAdded:Connect(function(player) pcall(function() local tool = dataStore:GetAsyne("User-"..player.UserId) if tool then for i,v in pairs(tool) do local toolFound = game.ReplicatedStorage.Items:FindFirstChild ***if*** toolFound then toolFound:Clone().Parent = player.Backpack toolFound:Clone().Parent = player.StarterGear end end end end) end) game.Players.PlayerRemoving:Connect(function(player) pcall(function() local toolsSave = {} for i, tool in pairs(player.Backpack:GetChildren()) do if tool then table.insert(toolsSave,tool.Name) end end dataStore:SetAsync("User-"..player.UserId,toolsSave) end) end)