I'm trying to figure out the best way to save the swords a player owns. My current way is just a number for each sword but I realized this won't work for more swords. I was thinking of making a data save for every sword and making it 1 for owning and 0 for not but I thought there might be a better way.
Heres what I currently have:
game.ReplicatedStorage.Purchase.OnServerEvent:Connect(function(Player, Sword) if Sword == "Bronze Sword" and Player.leaderstats.Points.Value >= 25 and Player.EquipedSword.Value ~= 2 and Player.EquipedSword.Value ~= 23 then Player.leaderstats.Points.Value = Player.leaderstats.Points.Value - 25 Player.PlayerGui.SwordShop.Frame.Bronze.Text = "[OWNED] Bronze Sword" if Player.EquipedSword.Value == 3 then Player.EquipedSword.Value = 23 else Player.EquipedSword.Value = 2 end elseif Sword == "Iron Sword" and Player.leaderstats.Points.Value >= 50 and Player.EquipedSword.Value ~= 3 and Player.EquipedSword.Value ~= 23 then Player.leaderstats.Points.Value = Player.leaderstats.Points.Value - 50 Player.PlayerGui.SwordShop.Frame.Iron.Text = "[OWNED] Iron Sword" if Player.EquipedSword.Value == 2 then Player.EquipedSword.Value = 23 else Player.EquipedSword.Value = 3 end end end)
Thanks in advance.
I'd say give each Item an ID code (or just use it's name), and save the list of IDs to a DataStore, so every time they join, it goes through maybe a table or ModuleScript of IDs, and if they have that ID, it gives them the correlating Item. I'm at school so i don't have time to code it though, sorry!