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)
1 Like
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)
2 Likes
I just did that, nothing printed at all. I’m guessing for some reason the script isn’t running, even though it’s enabled
Where script is located ?
najsdnklasjd - need characters to post
Maybe the WaitForChild is yielding forever, any warnings in console?
No warnings either, I’m gonna try making it disabled and enabling it with a seperate script
Scripts do not work on replicated storage
it gets cloned into workspace
characters
Please provide an Output, preferably with debug.
Even when I put debug, it puts nothing in output. Literally nothing. it’s just empty.
Have you tried putting the script in another location? Just to test
I haven’t, I’ll try a few different places.
local scripts don’t work in workspace
It is placed on the player’s Character.
I just made a different script, and that fixed the issue. I forgot local script couldn’t run in workspace.
they work if they are in the Character of player, as you said they were.