Well, basically I want that if the tool you are looking for is not found with a GetChildren, the esleif part is executed. I already have the if which is when the tool exists because it will put an IntValue value in the text, but for some reason the elseif is not executed when the tool does not exist. Line 62 a 71
local StackText = script.Parent.Parent.Nivel.NumStack
local EnabledA = script.Parent:FindFirstChild("EquipTools")
local Inventory = script.Parent.Parent.Mapa.ViewSelection:WaitForChild("Inventario")
function handleEquip(tool)
if tool then
if EnabledA.Value == false and script.Parent.Parent:WaitForChild("Mapa"):WaitForChild("OpenOrNotOpen").Value == false then
if tool.Parent ~= char then
hum:EquipTool(tool)
for i, ToolsHumanoid in pairs(char:GetChildren()) do
if ToolsHumanoid:IsA("Tool") then
if tool.Name == ToolsHumanoid.Name then
Inventory.Handler.Selected.Value = ToolsHumanoid
Inventory.Handler.Equipped.Value = ToolsHumanoid
Inventory.Handler.Location.Value = bp
Inventory.Frame.ItemName.Text = ToolsHumanoid.Name
Inventory.Frame.ImageLabel.Image = ToolsHumanoid.TextureId
Inventory.Frame.Equip.BackgroundColor3 = Color3.fromRGB(180, 180, 180)
Inventory.Frame.Equip.Text = "Guardar"
end
end
for index, StackValues in pairs(ItemStacks:GetChildren()) do
if ToolsHumanoid.Name == StackValues.Name then
StackText.Text = StackValues.Value
StackText.Visible = true
elseif not ToolsHumanoid.Name == StackValues.Name then -- this
StackText.Text = "0"
StackText.Visible = false
end
end
end
else
hum:UnequipTools()
Inventory.Handler.Selected.Value = nil
Inventory.Handler.Equipped.Value = nil
Inventory.Handler.Location.Value = nil
Inventory.Frame.Equip.Text = "Equipar"
Inventory.Frame.ImageLabel.Image = ""
Inventory.Frame.ItemName.Text = "Seleccione"
Inventory.Frame.Equip.BackgroundColor3 = Color3.fromRGB(118, 118, 118)
end
end
end
end