So, I have a inventory system, and this script is supposed update the item in the inventory to sync the stats. everything exists that needs to for the script, the value itself does change, but it just won’t work. I’ve tried a lot of different variations.
local RS = game:GetService("ReplicatedStorage")
local event = RS:WaitForChild("Equip")
local player = game.Players.LocalPlayer
local inventoryGui = player:WaitForChild("PlayerGui"):WaitForChild("Inventory")
local container = inventoryGui.BG:WaitForChild("Container")
local stepsValue = script.Parent
local slot = script.Parent.Parent.Slot.Value
stepsValue:GetPropertyChangedSignal("Value"):Connect(function()
local newValue = stepsValue.Value
for i, child in pairs(container:GetChildren()) do
if child.Name == slot then
child.CurrentSteps.Value = newValue
end
end
end)
When this kind of thing happens to me, I do a lot of debugging
Can you do that and show me the output?
local RS = game:GetService("ReplicatedStorage")
local event = RS:WaitForChild("Equip")
local player = game.Players.LocalPlayer
local inventoryGui = player:WaitForChild("PlayerGui"):WaitForChild("Inventory")
local container = inventoryGui.BG:WaitForChild("Container")
local stepsValue = script.Parent
local slot = script.Parent.Parent.Slot.Value
print("____ Debug - 1 ____")
print(inventoryGui)
print(container)
print(stepsValue)
print(slot)
stepsValue:GetPropertyChangedSignal("Value"):Connect(function()
local newValue = stepsValue.Value
print("____ Debug - 2 ____")
print(newValue)
for i, child in pairs(container:GetChildren()) do
print("____ Debug - 3 ____")
if child.Name == slot then
print("____ Debug - 4 ____")
child.CurrentSteps.Value = newValue
end
end
end)