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

How Do I Pick 1 Single Child From A "for i, v in pairs() do" loop?

Hey Devs I Made A Script And Now I Am Having Problems On How DO I Select Only 1 Child From A for i,v loop

Local Script

local TEST = game.ReplicatedStorage.test
wait(5)
print("Script Started")

for i, v in pairs(game.Workspace:GetChildren()) do
	if v:IsA("Part") then
		if v.Position == v.Position then
			TEST:FireServer(v)
		end
	end
end

Script

local TEST = game.ReplicatedStorage.test

TEST.OnServerEvent:Connect(function(player,v)
	if v.Name == "Base" then
		return false
	else
		print(v.Name)
	end
end)

Thanks

1 comment

0

It Works But Dosent Actually Get Only 1 Child

1 answer

Answered

1 comment

0

For those who want the answer, you simply add a "break" at the point you want to stop at :D

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