So I made an inventory on my simulator, but I need an image to be displayed based on when a boolvalue is true for "filled" and the PetID equals a certain ID. I was going to make a table, but I was just testing the ID first to see if it would go to the direct frame that I needed. I don't know if this is how you use i,v in pairs correctly, but if someone could help me change the image based on the PetID and the boolvalue "filled" being true, I'd appreciate it. The following code is what I have so far

while wait(.1) do
	for i, v in pairs(script.Parent.Handler:GetChildren()) do
		if v:IsA("Frame") then
			if v.Filled == true then
				if v.SlotInfo.PetID.Value == 2 then
									v.Display.Image = "rbxgameasset://Images/1EarthGreenPet"
				end
			elseif
				v.Filled == false then
					v.Display.Image = ""
			end
			
			
		end
	end 
end

6 comments

0

Don't use wait() as your loop's condition; it's a hack.

1

if Filled is a bool value,shouldn't it be v.Filled.Value instead of v.Filled?

0

lol

0

lol wow I can't believe i forgot to put value, thanks for the catch

0

i'd rather use ClassName and not IsA

0

Ah thanks, I had no idea about the ClassName property