I am working on an inventory system, that every time a value is added to the inventory folder, it adds it to the Gui.
Everything worked perfectly fine in the studio. It worked every time. But when I join the game, the Gui is empty, and I am sure that the items were loaded because I data stored them, and printed their names and values.
I tried to wait until the character exists, I tried to check if the Gui is empty and then clone the template to the GUI.
I also tried to put prints to see if it works and if the function runs, the prints are printed in the studio, and not in-game.
I know that the script itself runs because I also printed outside of any functions, and it printed both in-game and in the studio
That’s my local script, the parent of it is the frame, and there’s a grid layout there:
local player = game:GetService("Players").LocalPlayer
local inventory = player:WaitForChild("Inventory")
inventory.ChildAdded:Connect(function(item)
if(not script.Parent:FindFirstChild(item.Name)) then
local clone = game:GetService("ReplicatedStorage"):WaitForChild("Template"):Clone()
clone.Name = item.Name
clone.ItemName.Text = item.Name
clone.Count.Text = item.Value
item:GetPropertyChangedSignal("Value"):Connect(function()
clone.Count.Text = item.Value
end)
clone.Parent = script.Parent
end
end)
Does anyone know why it fires in the studio but not in-game?
Thanks for everyone who responds