.Changed doesn't work

script.AncestryChanged:Wait()

script.Parent.Changed:Connect(function (Value)
	print("detected server side")
end)

This is in a server script, it’s parent is a numbervalue, and the value & script are cloned by another script. The function will not run no matter what, I have no clue what the issue is.

Remove the space after function. Try that.

Nothing changed, btw I forgot to say there’s also no errors

Try removing the first line.

I’ve tried the script with and without it, doesn’t work either way

Send me what the script looks like in explorer along with its descendants and close parents.

Why don’t you use “.AncestryChanged” instead?

Wdym? That’s what I used (characters)

Screenshot 2023-12-20 at 5.27.33 PM

Then if you’re waiting for the ancestry to change .Parent.Changed would not fire most likely. You could remove the lines below it and replace it with whatever function you have to perform.

Is the value being changed on the client? If so, the server can’t detect changes made by clients.

That part is there because the script gets cloned and added to the player, so I want the .Changed function to be added only when the Money value has already been cloned

No, I’ve tried changing it in a server script, command bar, and manually in explorer while testing

Then what is the point of .Changed? (unless after it changes it’s parent you want it to detect another change?)

Oh, try changing the value to somewhere else like workspace and command change it and see if it prints anything.

script.AncestryChanged:Wait() is to wait for the value & script to be cloned
script.Parent.Changed will run every time the Money value is changed (the script will fire a client event to edit a money GUI every time the money value is changed)

Are you trying to detect a value change? (then use script.Parent.Changed or :GetPropertyChangedSignal(“Value”))

First one doesn’t exist, second one still doesn’t work

Are you not getting an output?

Try this.

script.AncestryChanged:wait()

script.Parent:GetPropertyChangedSignal("Value"):Connect(function(v)
	print("detected server side")
end)