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

I'm a beginner. Anyone knows the flaw with this 'code' block?

paper = game.Workspace.trihard
paper.Transparency = 1
if
paper.Transparency == 1 then
 paper.BrickColor = BrickColor.new("Really red")
if
paper.BrickColor == "Really red" then
print("it is transparent + red")
else 
	print("it isnt")
end
end

this prints "it isnt" what is the flaw here? i'm trying to make it transparent and red and if it is then it prints "it is transparent + red"

1 answer

✓ Accepted answer

"Really red" is a string. When checking brick color, you want to compare brickcolors.

this statement is TRUE if your brick's color is the Really red brick color:

your part's brickcolor == BrickColor.new("Really red")

but this statement is NOT since your brickcolor is not a string.

your part's brickcolor == ("Really red")

paper = game.Workspace.trihard
paper.Transparency = 1

if paper.Transparency == 1 then
	paper.BrickColor = BrickColor.new("Really red")

	if paper.BrickColor == BrickColor.new("Really red") then
		print("it is transparent + red")
	else 
   		print("the brick's transparency is 1, but it's brick color is NOT red.")
	end
end

1 comment

0

God bless you. Although I did not see what you meant at the beginning I found the error now. Thanks.

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