This is what I have so far! it only works if the string value in the workspace turns to it right away would I need to use .Changed some how?
while true do if script.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Workspace.announcement.Value == "No Announcements" then script.Parent.BackgroundColor3 = Color3.fromRGB(255, 255, 255) wait() end if script.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Workspace.announcement.Value == "Tornado Watch" then script.Parent.BackgroundColor3 = Color3.fromRGB(255, 170, 0) wait() end if script.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Workspace.announcement.Value == "Tornado Warning" then script.Parent.BackgroundColor3 = Color3.fromRGB(255, 0, 0) wait() end end
Try to avoid using any loops that only detects simple changes/updates
local announcement = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent.announcement -- Define announcement, easier to type instead of .Parent 7 times everytime. announcement:GetPropertyChangedSignal("Value"):Connect(function() -- Detect when announcement's value is changed, and when it is run below code if announcement.Value == "No Announcement" then -- Start off with if. script.Parent.BackgroundColor3 = Color3.fromRGB(255, 255, 255) elseif announcement.Value == "Tornado Watch" then -- Continue all others with elseif. script.Parent.BackgroundColor3 = Color3.fromRGB(255, 170, 0) elseif announcement.Value == "Tornado Warning" then script.Parent.BackgroundColor3 = Color3.fromRGB(255, 0, 0) end -- Only one end to wrap up all of the if statements. The code will start at the top and if true it will change it to black. If its false it'll move on and continue until true. Faster than running multiple if statements that each have end's end) -- Overall running a while true do to update a simple variable that only changes every so often is resources wasted. You should only run the script when the value itself is changed, therfor only running when it needs to.