I have made a LocalScript that is for a Text Button. The text button is supposed to look at another Text Box and see what a player typed in. If the player typed in a valid colour and clicked the text button, it will change the colour of the wall to the colour they typed in. This does work, but it only works for the first time you do it. You cannot change the colour again. How do I fix this issue?
Code:
local wall = game.Workspace.Tower
local button = script.Parent
local Box = script.Parent.Parent.ColorBox
button.MouseButton1Click:Connect(function(plr)
if Box.Text == "Green" or "green" then
wall.BrickColor = BrickColor.new("Lime green")
if Box.Text == "Red" or "red" then
wall.BrickColor = BrickColor.new("Really red")
if Box.Text == "Pink" or "pink" then
wall.BrickColor = BrickColor.new("Pink")
if Box.Text == "Blue" or "blue" then
wall.BrickColor = BrickColor.new("Medium blue")
if Box.Text == "Yellow" or "yellow" then
wall.BrickColor = BrickColor.new("New Yeller")
if Box.Text == "Orange" or "orange" then
wall.BrickColor = BrickColor.new("Deep orange")
if Box.Text == "Violet" or "violet" or "Purple" or "purple" then
wall.BrickColor = BrickColor.new("Royal purple")
end
end
end
end
end
end
end
end)
