local Assets = RS:WaitForChild("Assets")
local GUI = Assets:WaitForChild("GUIS")
local GUIS = GUI:GetChildren()
print(GUIS)
for _, v in ipairs(GUIS) do
print(v)
print(itemName)
if v == itemName then
local clone = v:Clone()
clone.Parent = player:WaitForChild("PlayerGUI").InvScreenGUI.InvFrame.Storage
print("should clone")
else
print("gui does not exist")
end
end
v and itemName print the exact same thing, i tried converting them both to strings just in case but it still only prints “gui does not exist”. wth am i doing wrong i dont want to think anymore
I believe itemName is in the form of a string. To account for this, you should use v.Name instead of v. (tostring(v) returns nil, hence why it didn’t work earlier).
i.e.
local Assets = RS:WaitForChild("Assets")
local GUI = Assets:WaitForChild("GUIS")
local GUIS = GUI:GetChildren()
print(GUIS)
for _, v in ipairs(GUIS) do
print(v)
print(v.Name) -- Print the name of the GUI instance
print(itemName) -- Print the itemName to check its value
if v.Name == itemName then
local clone = v:Clone()
clone.Parent = player:WaitForChild("PlayerGUI").InvScreenGUI.InvFrame.Storage
print("should clone")
else
print("gui does not exist")
end
end