Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

why wont FindFirstChildWhichIsA work on a i,v loop?

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


2 comments

0

tools might have not loaded in yet

0

use if v:IsA("Tool") then ... end

1 answer

✓ Accepted answer

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.

1 comment

0

Should have been a comment.

This discussion is preserved as it was. New answers, comments, and votes are closed.