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

why wont FindFirstChildWhichIsA work on a i,v loop?

Asked by 5 years ago
Edited 5 years ago
for i,v in pairs(game.Workspace:GetChildren()) do
    if v:FindFirstChildWhichIsA('Tool') then
        print('LOL')
    end

end

its supposed to print 6 LOL cause theres 6 tools but its not doing anything

I also need help doing

Looking for values inside the tools of workspace

the Value is a IntValue but this also dosent seem to work

for i,v in pairs(game.Workspace:GetChildren()) do
    Find =  v:FindFirstChildWhichIsA('Tool')
    if Find then
        Val = Find:FindFirstChild('Value')
        if Val then
            print(Val.Value)
        end
    end 


end


0
tools might have not loaded in yet Warfaresh0t 414 — 5y
0
use if v:IsA("Tool") then ... end yHasteeD 1819 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago

Right now you are looking through v to see if they are the parent to a tool. Take "FindFirstChildWhich" out of the script and it will work perfectly.

0
Should have been a comment. User#24403 69 — 5y
Ad

Answer this question