Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Is line 3 of the 'while condition do' function correct?

Asked by
RAYAN1565 691 Moderation Voter
8 years ago

Trying to make a function where the brick color changes randomly and stops changing once reaches the color, dark blue.

local a = script.Parent

while a.BrickColor ~= "Dark blue" do --this line is not being executed properly
    a.BrickColor = BrickColor.Random()
    wait(0.25)
end

1 answer

Log in to vote
1
Answered by
LostPast 253 Moderation Voter
8 years ago
local a = script.Parent

while a.BrickColor ~= BrickColor.new("Dark blue") do --You must call BrickColor.new when designating a BrickColor.
    a.BrickColor = BrickColor.Random()
    wait(0.25)
end
1
Thanks! It worked perfectly. RAYAN1565 691 — 8y
Ad

Answer this question