You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? a function that runs when a ObjectValue.Value changes then runs my code each time it changes.
-
What is the issue? the ObjectValue:GetPropertyChangedSignal(‘Value’) only runs once
-
What solutions have you tried so far? it works if i remove my code and prints into console. but for some reason my code is messing with the GetPropertyChangedSignal Event
I’m trying to make a function() that runs some code when an ObjectValue.Value changes. but for some reason my code is messing with the GetPropertyChangedSignal Event and only running it once.
code:
Local_Folder_Directory[i]:GetPropertyChangedSignal('Value'):Connect(function()
-- sort list
local r_x = 1
local nr_x = 1
for x=1,Settings.Inventory_Size do
if Local_Folder_Directory[x].Value then
-- if true
if r_x ~= x then
Local_Folder_Directory[x].Name = r_x
end
r_x += 1
else
-- if nil
Local_Folder_Directory[x]:Destroy()
local New_Folder_Value = Instance.new('ObjectValue')
New_Folder_Value.Name = Settings.Inventory_Size - (nr_x - 1)
New_Folder_Value.Parent = Local_Folder_Directory
nr_x += 1
end
end
end)
why is it only running once. I can’t see anything in the code that would break it?