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

[?]For in pairs loop

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.

2 comments

0

What is not working about it? "BasePart" is the class from which all Part types inherit from, use that for greater generality.

2

This will loop through all the objects in workspace, not their children. Therefore 'v.Parent' will always be workspace.

1 answer

✓ Accepted answer

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

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