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

i am using in pairs for a tools but it keeps on printing the first tool in my hot-bar how do i fix?

Asked by 5 years ago
script.Parent.Touched:Connect(function(hit)
    local humanoid = hit.Parent:FindFirstChild("Humanoid")
    local plr = game.Players.LocalPlayer

    if (humanoid ~= nil) then   
 for d,tools in pairs(plr.Backpack:GetChildren()) do 

    local i = Instance.new("TextLabel")
    local find = plr.PlayerGui:FindFirstChild("pack")
    i.Parent = find.Back
    if tools:IsA("Tool") then   
        i.Text = tools.Name
        print(tools.Name)
        break

    end
end
    end
end)
0
because you are only checking if it is a tool, if you want a specific tool, just check for that tool like : if tools.Name == "NameHere" then theking48989987 2147 — 5y
0
no, i want all the tools that are in backpack in local player helleric -3 — 5y
0
can you give us the output and the hierarchy of the backpack? aazkao 787 — 5y
0
uhh what helleric -3 — 5y

Answer this question