I noticed that you have two objects inside of workspace called "adsyg". When you try to retrieve an object inside of a hierarchy it will return the first object of the name you give it. So if you try to do the whole "workspace.adsyg" twice, it will just return the same object twice.
In order to get both objects like you are trying to, you could either put the number value inside of the part or just change the name of the number value.
Another thing is on the first line when you declared value to be equal to workspace.adsyg.Value, since you're doing that any change to the number value after that will not be detected and the value variable will not change. This is because it's setting the variable to the value of the number value at that one time, it is probably in your interest to just get the number value object, and check the value when you need it.
Next, just a small syntax error on line 5 when comparing the value to a number. Just one equals sign "=" try's to set or declare something to be equal to another like a variable. What you want is a double equals sign "==" this compares two items together.
And finally just another small syntax error when setting the color of the parts. When setting the BrickColor it would be something like "part.BrickColor" and not "part.Color". When changing the color to a specific RGB value you can use "part.Color" with the Color3.fromRGB function.
Those were really the only problems I found with your code. Let me see if I can help fix it up for ya.
local part = workspace.adsyg
local value = part.adsyg
while true do
local number = value.Value
if number == 1 then
part.BrickColor = BrickColor.new("Lime green")
else
part.BrickColor = BrickColor.new("Bright red")
end
wait()
end
All I'm assuming with this code is that you just put the number value object inside the part that changes color.
I hope I was helpful.
2 comments
"=" is an assignment operator while "==" is a relational operator. And it wouldn't really help his script much because it can't properly get the number value, and the value variable is set at the value the number value is at the time the script runs, so it never changes.
Ah, thank you.