Hello! I have a very similar issue to this topic here:
You can skim through the topic and see my problem. I’ve been waiting for a bit and nobody seemed to reply, so I thought that I will make a new topic just for this since that topic already was marked as solved.
More Info on this:
I have many other things I use for DataStore2, I’m not to sure if its because I have too much of data to keep up with the update. (they are: Currency(Combined to Coins, Level), Inventory(Combined), and Slots(Combined) ~ this is the one giving me issues).
If you have any questions, don’t understand, or need more code please tell me! Thank you.
I am not sure myself what did the 2nd Arguement did Datastore2 return but the reason why it’s not update because it didn’t return Instance you want to update i edit some code
for key, stringValue in pairs(slotsStore) do local curSlot = player.Slots:FindFirstChild(key) updateEquippedSlots(stringValue:Get(defaultEquippedSlots[key]), curSlot) stringValue:OnUpdate(function(newString) updateEquippedSlots(newString, curSlot) end) end
Basically just pass the Instance you want to update to the updateEquippedSlots function (tell me if there still problem)
I change the value by when someone clicks a button it fires a remote function to the server.
game:GetService("ReplicatedStorage"):WaitForChild("Functions").Equip.OnServerInvoke = function(player, itemName) local char = player.Character local slotsStore = { GearSlot1 = DataStore2("GearSlot1", player), GearSlot2 = DataStore2("GearSlot2", player), GearSlot3 = DataStore2("GearSlot3", player), PerkSlot = DataStore2("PerkSlot", player), } local item, inInventory, isEquipped item = game:GetService("ServerStorage").GameItems.Gears:FindFirstChild(itemName) for _, category in pairs(player.Inventory:GetChildren()) do if category:FindFirstChild(itemName) then inInventory = true if category:FindFirstChild(itemName).Value == true then isEquipped = true else isEquipped = false end break end end if inInventory then -- If the player owns the item print("in inventory") wait(1) for index, slot in pairs(player.Slots:GetChildren()) do print(index) print(slotsStore[slot.Name]) print(slot.Name) local slotStore = slotsStore[slot.Name] if slotStore:Get(defaultEquippedSlots[slot.Name]) == itemName then print("no") print(slot) slotStore:Set("", slot) print(slot.Value) --[[if player.Backpack:FindFirstChild(itemName) then player.Backpack:FindFirstChild(itemName):Destroy() player.StarterGear:FindFirstChild(itemName):Destroy() elseif player.Character:FindFirstChild(itemName) then player.Character:FindFirstChild(itemName):Destroy() player.StarterGear:FindFirstChild(itemName):Destroy() break end]] return "Unequip" elseif slotStore:Get(defaultEquippedSlots[slot.Name]) == "" then print(item.Parent) print(item.Name) print("item set") slotStore:Set(item.Name, slot) print(slotStore:Get(defaultEquippedSlots[slot.Name])) return "Equip" end end end end