Value.changed not working

i have a value in my tool, and every time it changes, the text in the tool will change according to the value number, i tried printing, and the printing did not go through, i tried making it a local script, but it still doesn’t work. there is no error so i don’t really know what i did wrong here, heres the script:

wait()
local value = script.Parent.Value
script.Parent.Handle.Bill.TextLabel.Text = value.Value
value.Changed:Connect(function()
	print("changed")
	script.Parent.Handle.Bill.TextLabel.Text = value.Value
end)
1 Like

It doesnt work by directly placing the value of the variable, but simply the variable
can you put the script inside the value? – and you change the other line

wait()
local value = script.Parent
script.Parent.Handle.Bill.TextLabel.Text = value.Value
value.Changed:Connect(function()
	print("changed")
	script.Parent.Handle.Bill.TextLabel.Text = value.Value
end)

like this? i added another parent because its uh in the tool
Screen Shot 2021-12-21 at 10.19.17 AM
it seems to be not working, do i use local script instead?

I think I was wrong, calling it value makes it so confusing, youd better leave it as it was before, I think the problem is that you arent changing the value at any time and if you have already done it you should declare local value first before changing it, then you do the function

huh in my other local script it does the changing, do i have to do something with it?

Is the parent of the script any value holder, such as: StringValue, IntValue, NumberValue, etc?

it is int value…wait theres a number value? should i use that then?

No, that is not the source of the issue (Just for the thing though, Int values can only hold integers while Number values can hold floats). The thing is, you are not referencing the value holder instance but rather it’s value. Assuming it’s value was 0, you are doing 0.Changed, .Changed is not a valid member of 0.
Consider changing your code to:

wait()
local valueInstance = script.Parent
local value = valueInstance.Value
script.Parent.Handle.Bill.TextLabel.Text = value
valueInstance.Changed:Connect(function()
	print("changed")
	script.Parent.Handle.Bill.TextLabel.Text = value
end)
1 Like
local value = script.Parent

function changeValue()
    script.Parent.Handle.Bill.Text = tostring(value.Value)
    print("Changed!")
end

value:GetPropertyChangedSignal("Value"):Connect(function()
    changeValue()
end)

That should work!

1 Like

ill try that when. i get home, thanks

1 Like

You cant detect it by the value directly. Change the “value” variable to equal Script.Parent and then it should work

hmm nope don’t work…whaaaaaaattt

try this

repeat wait( ) until game.Players.LocalPlayer.CharacterAdded
local value = script.Parent.Value
script.Parent.Handle.Bill.TextLabel.Text = value.Value
value.Changed:Connect(function(new)
	print(tostring(new))
	script.Parent.Handle.Bill.TextLabel.Text = value.Value
end)

is this local script or server script?

uhm- that’s the local script
btw- it doesn’t change the text for everyone, only for the localplayer

how would i make it server sided? do i make it an server script?

oh and that dosn’t work for some reason

Other method u can try if the value property has changed with changedsignal

Here is one of the methods u can try:

wait()
local value = script.Parent
script.Parent.Handle.Bill.TextLabel.Text = value.Value
value.GetPropertyChangedSignal("Value"):Connect(function()
	print("changed")
	script.Parent.Handle.Bill.TextLabel.Text = value.Value
end)

Are you trying to change a text of a gui to everyone in the server (so everyone can see it)?
if thats the case you could fire an event when the value has changed, so fire a event on local script, make server script react on server event and change the gui text for everyone in the game.

is there a problem with billboard gui or something? hmm ima try use gui instead…anyways it dosn’t work