The purpose of this script is for the block this script is in, if the value labeled resources, is 1000 it will be 1000, it will be 1 color, and if its 900 it will be another color, for some reason, i Don't get any errors, but the colors wont change. Please help me out! Thanks for reading.
if workspace.Resources.Value == 1000 then script.Parent.BrickColor = BrickColor.new("Bright green") elseif workspace.Resources.Value == 900 then script.Parent.BrickColor = BrickColor.new("Br.yellowish green") end
Well, there are 2 ways you can solve your problem. By using a Changed event, or a loop. I'll show both. The reason yours doesn't work, is because it doesn't know when to check if the value is 1000 or 900!
Changed:
game.Workspace.Resources.Changed:connect(function() if game.Workspace.Resources.Value == 1000 then script.Parent.BrickColor = BrickColor.new("Bright green") elseif game.Workspace.Resources.Value == 900 then script.Parent.BrickColor = BrickColor.new("Br.yellowish green") -- Heh, I've never seen that. Make sure spelling is correct! end end)
Loop:
while wait() do if game.Workspace.Resources.Value == 1000 then script.Parent.BrickColor = BrickColor.new("Bright green") elseif game.Workspace.Resources.Value == 900 then script.Parent.BrickColor = BrickColor.new("Br.yellowish green") end end