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

[?]For in pairs loop

Asked by 10 years ago

I can't seem to find what wrong with the script and the output isn't coming up with errors.

mode = game.Workspace:GetChildren()

for i,v in pairs (mode) do
    if v.Parent:IsA("Part") then 
        v.Parent.Name = "Part" .. v
    print(v.Name) wait(1)
    end 
end

If I could help I'll be grateful.

0
What is not working about it? "BasePart" is the class from which all Part types inherit from, use that for greater generality. duckwit 1404 — 10y
2
This will loop through all the objects in workspace, not their children. Therefore 'v.Parent' will *always* be workspace. Perci1 4988 — 10y

1 answer

Log in to vote
2
Answered by 10 years ago

You are renaming Workspace (attempting) rather than the part)

mode = game.Workspace:GetChildren()

for i,v in pairs (mode) do
    if v:IsA("Part") then 
        v.Name = "Part"
    print(v.Name) wait(1)
    end 
end

Ad

Answer this question