Hello!
I am Trying to Use :GetPropertyChangedSignal(“Value”) To get When The Value Changes.
However, My script Is not Detecting the Change.
game.ReplicatedStorage.ObbyTime:GetPropertyChangedSignal("Value"):Connect(function()
print("A Second Passed In Obbby")
if game.ReplicatedStorage.ObbyTime.Value == 0 then
print("Obby Over")
end
end)
When i test It Out, I see No Prints in the output. The value is In replicated Storage and Is Changing every Second. I am Using This script in ServerScriptService as a Script
Instead of using GetPropertyChangedSignal function, you can use Changed event on IntValues
game.ReplicatedStorage.ObbyTime.Changed:Connect(function()
print("A Second Passed In Obbby")
if game.ReplicatedStorage.ObbyTime.Value == 0 then
print("Obby Over")
end
end)
If it still doesn’t work, could I learn what type of script it is?
It looks like you’re trying to achieve a countdown script. Try something around RunService and os.clock() like this. An alternative substitute with os.clock() might be time().
local RunService = game:GetService("RunService")
local function startCountdown(duration)
local start = os.clock()
while os.clock() - start < duration do
RunService.Heartbeat:Wait()
end
-- any other line here
print("Countdown expired.")
end