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

Made a script so that if the brick ='d a certain color the size would change, what's wrong?

var1 = Instance.new("Part",workspace)
var1.Position = Vector3.new(0,0,0)
var1.Name = "Testing"
wait(3)
var1.BrickColor = BrickColor.new("Really red")
var1.Transparency = 0.7
wait(3)
var1.Transparency = 0.7
var1.Anchored = true
if game.Workspace.Testing.Anchored == true then -- == means to compare "check if something is equal to something", = means is equal to --
	game.Workspace.Testing.BrickColor = BrickColor.new("Black")
end
wait(3)
var1.BrickColor = BrickColor.new("Carnation pink")
wait(3)
if game.Workspace.Testing.BrickColor == ("Carnation pink") then
	game.Workspace.Testing.Size = Vector3.new(20,20,20)
end

1 answer

✓ Accepted answer

in line 16, you were comparing the brick's color to the string "Carnation pink". These are two different values, so just compare the color of the brick to the color "Carnation pink" instead of the string.

Additionally, you can substitute your references to the brick at the bottom with "var1"

var1 = Instance.new("Part",workspace)
var1.Position = Vector3.new(0,0,0)
var1.Name = "Testing"
wait(3)
var1.BrickColor = BrickColor.new("Really red")
var1.Transparency = 0.7
wait(3)
var1.Transparency = 0.7
var1.Anchored = true
if var1.Anchored == true then -- == means to compare "check if something is equal to something", = means is equal to --
    var1.BrickColor = BrickColor.new("Black")
end
wait(3)
var1.BrickColor = BrickColor.new("Carnation pink")
wait(3)
if var1.BrickColor == BrickColor.new("Carnation pink") then --must compare brick color with brick color
    var1.Size = Vector3.new(20,20,20)
end

3 comments

0

What would you replace line 16 with?

0

if var1.BrickColor == BrickColor.new("Carnation pink") then

0

I fixed the script for you, you can compare the new one to the old one to see what I edited.

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