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

how do i use in pairs but with noo loop? [closed]

Asked by 6 years ago

here is script

01script.Parent.Touched:Connect(function(hit)
02    local humanoid = hit.Parent:FindFirstChild("Humanoid")
03    local plr = game.Players.LocalPlayer
04    local i = Instance.new("TextLabel",plr.PlayerGui.pack.Frame)
05    if (humanoid ~= nil) then  
06 for _,tools in pairs(plr.Backpack:GetChildren()) do
07    if tools:IsA("Tool") then
08 
09        i.Text = tools.Name
10        print(tools.Name)
11    end
12 
13end
14    end
15end)
0
Uh i dont understand your question, what are you trying to do here? aazkao 787 — 6y
0
i am trying to get the tools from player back pack but i keeps on making more like i have one tool but it make like 7 ;-; helleric -3 — 6y
0
add a break Decimaprism 65 — 6y
0
..?? helleric -3 — 6y
View all comments (2 more)
0
break the loop when you find the tool theking48989987 2147 — 6y
0
how thou helleric -3 — 6y

Closed as Not Constructive by shayner32, chexburger, green271, zblox164, and User#21908

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
1
Answered by 6 years ago
01script.Parent.Touched:Connect(function(hit)
02    local humanoid = hit.Parent:FindFirstChild("Humanoid")
03    local plr = game.Players.LocalPlayer
04    local i = Instance.new("TextLabel",plr.PlayerGui.pack.Frame)
05    if (humanoid ~= nil) then 
06 for _,tools in pairs(plr.Backpack:GetChildren()) do
07    if tools:IsA("Tool") then
08        i.Text = tools.Name
09        print(tools.Name)
10    break -- This is what aazkao means by break
11   end
12end
13    end
14end)
0
And I assume thats where you want your break to be right? PenguinDevs 45 — 6y
Ad