Im trying to check if there is something inside of a frame that has the name of something inside of a table but it skips over it when it has something in it anyway and goes to the else
Code :
for i,v in pairs(getItems) do
if Holding and equation and not Slotted and item.Name == Logs.itemName then
if slot:FindFirstChild(v) then
print("Something is inside of this frame there")
else
print("There is nothing inside of here")
item.Parent = slot
item.Position = slot.Center.Position
spawn(function()
setSlot:FireServer(slot.Name,item.Name,"set")
end)
Logs.itemName = nil
WindowsXPBubble:Play()
Slotted = true
Holding = false
end
end
end
what is the “getItems” variable? is it an array with names or objects? if it is an array of objects you would have to put slot:FindFirstChild(v.Name) in the statement
local simpleThread = coroutine.wrap(function()
for _, slot in pairs(MAIN:GetDescendants()) do
for number = 1,maxSlots,1 do
if slot.Name == tostring(number) or slot.Name == "Primary" or slot.Name == "Secondary" then
for _, item in pairs(MAIN:GetDescendants()) do
if item:IsA("ImageLabel") and item.Name ~= "Item" then
local itemLocation = Vector2.new(item.AbsolutePosition.X,item.AbsolutePosition.Y) + item.AbsolutePosition / 2
local slotLocation = Vector2.new(slot.AbsolutePosition.X,slot.AbsolutePosition.Y) + slot.AbsolutePosition / 2
local equation = (itemLocation - slotLocation).Magnitude < 95
for i,v in pairs(getItems) do
if Holding and equation and not Slotted and item.Name == Logs.itemName then
if slot:FindFirstChild(v) then
print("Something is inside of this frame there")
else
print("There is nothing inside of here")
item.Parent = slot
item.Position = slot.Center.Position
spawn(function()
setSlot:FireServer(slot.Name,item.Name,"set")
end)
Logs.itemName = nil
WindowsXPBubble:Play()
Slotted = true
Holding = false
end
end
end
end
end
end
end
end
Are you sure getItems is not a dictionary? If you are setting the strings as index, you should work with keys instead. Try using i as argument for FindFirstChild if that’s the case.
I’m not much of a scripter, but I know elseif has something to do with doing something else if a statement is true or false depending on what you wrote for your code. If this doesn’t even relate or help, then I don’t know. Good luck!