1D0ME
(Dome)
March 9, 2022, 3:04am
#1
Can someone explain to me why this code is not working?
local value = script.Parent.Parent.Blocks.Value
script.Parent.Text = value
value.Changed:Connect(function()
script.Parent.Text = value
end)
I want to make it so that the text, is continuously changed to the integer value. When I do it, I only get the first integer number. But, after the value gets changed it does not update the text.
iBuzzes
(Ryry)
March 9, 2022, 3:09am
#2
It is because the value of the variable is not updated, do this:
local value = script.Parent.Parent.Blocks
script.Parent.Text = value.Value
value.Changed:Connect(function()
script.Parent.Text = value.Value
end)
1 Like
1D0ME
(Dome)
March 9, 2022, 3:11am
#3
Still didn’t work, does it have to be a local script or something?
Y_VRN
(Y_VRNDLL)
March 9, 2022, 3:13am
#4
I’m currently at my phone because our class software wouldn’t let me out. So, put the local variable inside the value.Changed function instead.
iBuzzes
(Ryry)
March 9, 2022, 3:14am
#5
Do you see any errors in the output? Is the code in a local script or a server script and where is it placed?
1D0ME
(Dome)
March 9, 2022, 3:17am
#6
Yeah,
Here is where it is placed:
1D0ME
(Dome)
March 9, 2022, 3:20am
#7
That didn’t work, either. (30 letters)
Forummer
(Forummer)
March 9, 2022, 3:21am
#8
local devilArmor = script.Parent
local frame = devilArmor.Parent
local blocks = frame:WaitForChild("Blocks")
devilArmor.Text = blocks.Value
blocks.Changed:Connect(function(newValue)
devilArmor.Text = newValue
end)
Make the script a local one.
Y_VRN
(Y_VRNDLL)
March 9, 2022, 3:21am
#9
Are you using an ObjectValue? (30 limit aaaa)
iBuzzes
(Ryry)
March 9, 2022, 3:21am
#10
The error could be because the instance class is an ObjectValue and the value is an instance, try using value.Value.Name instead
1D0ME
(Dome)
March 9, 2022, 3:22am
#11
Thank you! It worked! (30 letters)