local TextLabel = script.Parent
local Text = TextLabel.Text
local Power = workspace.OfficeCorridors.Desk.Buttons.PowerManager.PowerAmount
local Light1 = TextLabel.Parent.Parent.PointLight
local Light2 = TextLabel.Parent.Parent.SurfaceLight
local Green = Color3.new(0, 1, 0)
local Lime = Color3.new(0.5, 1, 0)
local Yellow = Color3.new(1, 1, 0)
local Orange = Color3.new(1, 0.5, 0)
local Red = Color3.new(1, 0, 0)
while task.wait(0.1) do
Text = tostring(math.round(Power.Value)).."%"
if Power.Value > 80 then
TextLabel.TextColor3 = Green
Light1.Color = Green
Light2.Color = Green
elseif Power.Value > 60 then
TextLabel.TextColor3 = Lime
Light1.Color = Lime
Light2.Color = Lime
elseif Power.Value > 40 then
TextLabel.TextColor3 = Yellow
Light1.Color = Yellow
Light2.Color = Yellow
elseif Power.Value > 20 then
TextLabel.TextColor3 = Orange
Light1.Color = Orange
Light2.Color = Orange
elseif Power.Value < 20 then
TextLabel.TextColor3 = Red
Light1.Color = Red
Light2.Color = Red
end
end```
#TextLabel not changing for whatever reason
1 messages · Page 1 of 1 (latest)
so the variable power is itself the value of power
u gotta do
local Power = workspace.OfficeCorridors.Desk.Buttons.Power
you are updating the variable text not changing the actual property
this is an int value workspace.OfficeCorridors.Desk.Buttons.Power.Value
wait I'll change the name so its easier to read
we know
I fixed it
the intvalue was named value
yes
which is confusing
the main thing was that he was referencing the value as a var and then he was trying to get the value of a value
I was not
Its ok
the instance's name was value so that code was correct, whats not right is the way youre updating the textlabel's text
wdym?
you can't just say local text = textlabel.text
text will only store the text thats inside the text label, not act as a reference to the property
that means if you have a textlabel with the word "text", and you had a variable called text, it would be equal to "text"
are you sure its not changing because you're doing > comparing the power value to lower numbers
** You are now Level 3! **