I’m trying to change the value of the stuff in inventory when the data of it changes.
When the data changes for anything in inventory the intvalue value doesn’t change but for stuff in leaderstats it does.
local Players = game:GetService("Players")
local ServerScriptService = game:GetService("ServerScriptService")
local Workspace = game:GetService("Workspace")
local DataStore2 = require(ServerScriptService.DataStore2)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
DataStore2.Combine("DATA", "Time", "Top", "KO", "EQ", "Tides", "Xmas")
Players.PlayerAdded:Connect(function(player)
local timeStore = DataStore2("Time", player)
local topStore= DataStore2("Top", player)
local koStore = DataStore2("KO'S", player)
local eqStore = DataStore2("EQ", player)
local TidesST = DataStore2("Tides", player)
local XmasST = DataStore2("Xmas", player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
local inv = Instance.new("Folder")
inv.Name = "Inventory"
local Time = Instance.new("NumberValue")
Time.Name = "Time"
Time.Value = timeStore:Get(0)
Time.Parent = leaderstats
--
local Top = Instance.new("NumberValue")
Top.Name = "Top"
Top.Value = topStore:Get(0)
Top.Parent = leaderstats
--
local KO = Instance.new("NumberValue")
KO.Name = "KO'S"
KO.Value = koStore:Get(0)
KO.Parent = leaderstats
local EQ = Instance.new("StringValue")
EQ.Name = "EQ"
EQ.Value = eqStore:Get("Classic")
EQ.Parent = player
local Tides = Instance.new("NumberValue")
Tides.Name = "Tides"
Tides.Value = TidesST:Get(0)
Tides.Parent = inv
local Xmas = Instance.new("NumberValue")
Xmas.Name = "Xmas"
Xmas.Value = XmasST:Get(0)
Xmas.Parent = inv
timeStore:OnUpdate(function(newPoints)
Time.Value = newPoints
end)
topStore:OnUpdate(function(newPoints)
Top.Value = newPoints
end)
koStore:OnUpdate(function(newPoints)
KO.Value = newPoints
end)
TidesST:OnUpdate(function(newPoints)
TidesST.Value = newPoints
end)
XmasST:OnUpdate(function(newPoints)
XmasST.Value = newPoints
end)
eqStore:OnUpdate(function(newPoints)
EQ.Value = newPoints
end)
leaderstats.Parent = player
inv.Parent = player
end)```