I have a brick, and I want to make an "if then" function..
For example, if the color is Really Blue, then make the part's transparency .5. I'm not sure how to make a script detect the color... any help?
EDIT: Why doesn't this work?
Brick = script.Parent AnotherBrick = game.Workspace.TP
if game.Workspace.Screen.brickcolor.Name == "Bright green" then Brick.Touched:connect(function(part) if part.Parent.Humanoid then -- * if part.Parent.Humanoid.Health > 0 then part.Parent:MoveTo(AnotherBrick.Position) end end end)
if game.Workspace.Part.brickColor.Name == "Really blue" then game.Workspace.Part.Transparency = 0.5 end
This line of code will take the children of a certain location and apply the transformation if the colour of the child is Really blue:
local children = game.Workspace.Model:GetChildren() -- the game.Workspace.Model should be changed to the place you want to search for the part at. for i = 1, #children do if children[i]:IsA("BasePart") == true and children[i].BrickColor == "Really Blue" then children[i].Transparency = 0.5 end end