Part of my datastore script is not finding the path of the value I want

Greetings developers,

I’m so confused why this part of my datastore doesn’t find the specific parts I want it to find, any help that I can get? Everything else is fine about my code unless you think it’s better if I show my whole datastore code.

Code:

for i,v in pairs(player.PlayerGui.HUDGui.Inventory.Slots:GetDescendants()) do
	if v.Name:find("Slot") then
		if v:FindFirstChildOfClass("Frame") and v.Name == "Display" then
			print("Found#1")
			table.insert(uno, v.SlotB:FindFirstChildOfClass("Part").Name)  -- uno is a table!!
		else
			print("NotFound#1")
		end
	end
	wait(0.002)
end

It looks like I’ll have to re-do my saving method. Thank you for all who tried to help.

1 Like

I believe it stops at line 2 or 3. At line 2 you are checking if there is “Slot” in v’s name. Then, in line 3 you’re checking if v’s name is “Display”. Those two lines are going against each other.

1 Like

How would I counter this?

I still do not get how’d I do that.

I’ve tried some of my ideas, but none come to succeed, maybe there’s something I am missing.

1 Like

Do

if v:FindFirstChildOfClass("Frame") and v:FindFirstChildOfClass("Frame").Name == "Display" then

Instead of

if v:FindFirstChildOfClass("Frame") and v.Name == "Display" then

This is a fairly simple mistake, it’s caused by you checking if v’s name has anything to do with Slot, and then checking if it is “Display”, they go against eachother.

Also, I’m not really sure if your code will work either way, since you’re saving things from a GUI, you will have to set the members of the GUI from server side for it to save. (well, for server to find them on saving)

Either way, if after doing the proposed changes it doesn’t work, then you’ll have to rethink how your inventory saving will work. Good luck.

1 Like