Cant detect when a value changes

Hey! I tried to check when a value changed but when i execute the script it simply dont do anything, the console dont prints anything too, What i did wrong?

IMPORTANT: Its a ServerScript

My code:

local CounterValue
local Stopped = false

local CounterTimeValue = GameValues:FindFirstChild("CounterTime")

CounterTimeValue.Changed:Connect(function(value)
	print("Value Changed, New value: "..value)
	CounterValue = value
end)
1 Like

Do you update the CounterTimeValue on client? The updated value won’t replicate to the server thus the event will not fire.

Also, use :GetPropertyChangedSignal() instead.

I used :GetPropertyChangedSignal() and still the same (its a serverscript)

Are you modifying the value of CounterTimeValue via a LocalScript?

Using :GetPropertyChangedSignal() on a ValueBase Instance is a terrible idea, it just overcomplicates what is already there (which is the .Changed Value)


Be sure that the Server is made aware of any changes to the value so it fires, otherwise it wont fire at all.

You must also make sure the Script is Enabled, and is in a place where it can run (for example ServerScriptService)

1 Like

I was not aware that :GetPropertyChangedSignal() only detected value changes specifically for ValueBase instances. :smile:

Yes! It is in serverscriptservice, but it simply dont executes, and i dont know why

You didn’t answer the main question. Are you updating the value of CounterTimeValue on client?

No, Im updating it in serverscriptservice

image

The gameMixBase Is the script, i need to chenge the position or something?

GameValues:WaitForChild(“CounterTime”)

Is it really changing? When testing go server mode and watch the vape. Do you actually see it change?

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