Trying to update a TextLabel With a Values Value

I’ve been trying for a while about a day(I’m Sleep Deprived) to change the value of my textlabel to the value of a StringValue
My script:

	print(game.ReplicatedStorage.VoteValues.Value.Value)
	script.Parent.Text = game.ReplicatedStorage.VoteValues.Value.Value
end)``` Fair warning the value is almost aways updating

use a Changed Event.

VotesValues.Changed:Connect(function(newValue)
    script.Parent.Text = newValue
end)

It would be better to use GetPropertyChangedSignal since it will only fire when the property that you specified is changed.

Changed does not work the exact same way with ValueBase Objects, Changed when used with ValueBase Instances will give the newest Value, while with other Instances, it gives you the property.

ValueBase is the base class for stuff like ObjectValue, IntValue, NumberValue, etc.

It doesn’t matter too much. .changed for values only look for when the Value changes, and nothing else already. So if you changed the name, .changed would not fire (As seen with IntValues here if you want to learn more: Int values with .Changed

Oh, alright thanks for the clarification :+1:

1 Like

VoteValues Is a folder I Should of clarified

It should still work, if you Specify which Instance it is, so in this case:

VoteValues.Value.Changed:Connect(function(newValue)

But thats kind of on you for naming it Value

Woops It was the thing that was updating the value thanks for the help

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.