Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

looking for a way to see if a value has not changed?

Asked by 3 years ago

what i want to do is see if the value changed after 2 seconds

wait(2)
if not Value.Changed then
    print("value did not change")
end

i know this does not work as .Changed is supposed to be for functions, but thats a clear way to show you what i mean.

thanks for your help!

3 answers

Log in to vote
0
Answered by 3 years ago
local test = true

while wait(2) do
    if test == true then
        print("Value has not changed")
    end
end

Is this what you mean?

0
not really XD_Destroyer1234 4 — 3y
Ad
Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

This should work.

local checking = true
local valueToCheck = path
local ogValue = valueToCheck.Value

while true do wait(1)
    if checking == true then
        if valueToCheck.Value ~= ogValue then
            print('value is different')
            break
        else
        end
    end
end
Log in to vote
0
Answered by 3 years ago

I found clean way to do that

local prevTime = 0
local currTime = 0

prevTime = currTime
currTime = tick()
local passedTime = currTime - prevTime
if passedTime >= 2 then
    Value.Value = 1
end

Answer this question