I’m asking does replicatedstorage.Events.UpdateInventory
get fired every time the player’s inventory updates?
yes
Then you actually don’t need any of this:
What you would instead do is, on the serverscript that fires replicatedstorage.Events.UpdateInventory
, you would save the player’s inventory with inventorystore(inventory)
do i still fire from client?
So like this?
local event = game.ReplicatedStorage.Events:WaitForChild("UpdateInventory")
local datastore2 = game.ServerStorage:WaitForChild("DataStore2")
event.OnServerEvent:Connect(function(player)
local inventorystore = datastore2("Inventory", player)
inventorystore:Update(function(currentTable)
end)
end)