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

Script Help (SHORT)?

for i, v in pairs(game.Workspace:GetChildren()) do if v.BrickColor and v.BrickColor == BrickColor.new("Medium stone grey") then v.Name = "0" end end

The error comes out as:

21:57:56.209 - BrickColor is not a valid member of Model

I remember that there used to be a way around this, but I forgot the way. Help?

1 comment

1

Replace if v.BrickColor with if v:IsA('BasePart')

1 answer

✓ Accepted answer
for i, v in pairs(game.Workspace:GetChildren()) do 
	if v:IsA("Part") then 
		if v.BrickColor == BrickColor.new("Medium stone grey") 
			v.Name = "0" 
		end
	end 
end

You need to use :IsA(), as your script is also picking up models.

If this works, please +1 and accept the answer.

  • NinjoOnline

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