generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Why doesn't this work?

Previous Thread :: Next Thread 
Presting is not online. Presting
Joined: 16 Mar 2011
Total Posts: 715
19 Jul 2014 08:56 AM
I want to change the name of all bricks that are coloured "Dark stone grey" to "Stone" and all bricks that are coloured "Bright green" be named "Grass".


game.Workspace = world

if brick.Name = "Part" then

if world.Part.BrickColor = "Dark stone grey"

then world.Part.Name = "Stone"

if world.Part.BrickColor = "Bright green"

then world.Part.Name = "Grass"

end
Report Abuse
Presting is not online. Presting
Joined: 16 Mar 2011
Total Posts: 715
19 Jul 2014 09:02 AM
So I tried this as well, but it didn't work either? :

if game.Workspace.Part.BrickColor = "Bright green"
then game.Workspace.Part.Name = "Grass" else
game.Workspace.Part.Name = "Stone"
end
Report Abuse
cornytime is not online. cornytime
Joined: 07 Feb 2013
Total Posts: 3213
19 Jul 2014 09:04 AM
Part.BrickColor = BrickColor.new("Dark stone grey")
Report Abuse
WishNite is not online. WishNite
Joined: 11 Feb 2009
Total Posts: 15828
19 Jul 2014 09:05 AM
function recurse(model)
for i,v in ipairs(model:GetChildren()) do
if v:IsA("Part") then
if v.BrickColor == BrickColor.new("Dark stone grey") then
v.Name = "Stone"
elseif v.BrickColor = BrickColor.new("Bright green") then
v.Name = "Grass"
end
end
end
recurse(model)
end

recurse(workspace)
Report Abuse
Presting is not online. Presting
Joined: 16 Mar 2011
Total Posts: 715
19 Jul 2014 09:15 AM
@cornytime, I used yours like this but it only changed one brick name:

part = game.Workspace.Part

if part.BrickColor == BrickColor.new("Bright green")
then game.Workspace.Part.Name = "Grass" else

if part.BrickColor == BrickColor.new("Dark stone grey")
then game.Workspace.Part.Name = "Stone"
end
end

@WishNite, I tried yours and it did work, although gave some errors as well.
Report Abuse
Presting is not online. Presting
Joined: 16 Mar 2011
Total Posts: 715
19 Jul 2014 09:18 AM
Anyway, thanks! :)
Report Abuse
Presting is not online. Presting
Joined: 16 Mar 2011
Total Posts: 715
19 Jul 2014 09:32 AM
For those who want a working one, I tested out many version of WishNite's code and this one is the shortest and best way I could find (I think the extra functions he added were not necessary, but I don't know what they did honestly)

Here:

for i,v in pairs(game.Workspace:GetChildren()) do
if v.Name == "Part" then
if v.BrickColor == BrickColor.new("Bright green") then
v.Name = "Grass"
elseif v.BrickColor == BrickColor.new("Dark stone grey") then
v.Name = "Stone"
end
end
end
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image