Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

:IsA help and help with i,v in pairs possibly?

Asked by 5 years ago

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
0
Don't use wait() as your loop's condition; it's a hack. User#19524 175 — 5y
1
if Filled is a bool value,shouldn't it be v.Filled.Value instead of v.Filled? theking48989987 2147 — 5y
0
lol User#19524 175 — 5y
0
lol wow I can't believe i forgot to put value, thanks for the catch rhettsmith6537 109 — 5y
View all comments (2 more)
0
i'd rather use ClassName and not IsA greatneil80 2647 — 5y
0
Ah thanks, I had no idea about the ClassName property rhettsmith6537 109 — 5y

Answer this question