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

when i do in pairs it dose it more than once how do i stop that?

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 _,tools in pairs(plr.Backpack:GetChildren()) do
    if tools:IsA("Tool") then
        local i = Instance.new("TextLabel",plr.PlayerGui.pack.Frame)
        i.Text = tools.Name
        print(tools.Name)
    end

end
    end
end)
1
The point of a loop is that it does something multiple times. You are not very clear with your question. Could you explain your problem in more depth? User#21908 42 — 5y
0
The parent argument of Instance.new is deprecated. Also, I'm unsure exactly what you're trying to do. Either you don't know how loops work or you need to add a debounce. lunatic5 409 — 5y
0
"Break" greatneil80 2647 — 5y
0
This is in much need of articulation, can you do that? It would help a lot. One more thing: what is the script supposed to actually do? lazycoolboy500 597 — 5y

Answer this question