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

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

Asked by 3 years ago

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

0
It Works But Dosent Actually Get Only 1 Child kidsteve923 139 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

Answered

0
For those who want the answer, you simply add a "break" at the point you want to stop at :D mixgingengerina10 223 — 3y
Ad

Answer this question