It is possible to update a value mid function, you don't really need to use the If Then statement, as it will only check the first time it runs if it's the value you wanted.
This is what I'm trying to say.
Using the If Then will check only once if it's true, and then after that it will always print the new value. So, if the first value is equal to (0,0,0) then it will always run, even after the value is changed. But, if the first value is (1,1,1), then it will never run. So, you can just use :GetPropertyChangedSignal and check if the value is the value you want it to be.
So, this is how I would do it.
ZimeV:GetPropertyChangedSignal("Value"):Connect(function()
if ZimeV.Value == Vector3.new(0,0,0) then
print("Wrong Value Wait")
print(ZimeV.Value)
else
print("Found New Value")
print(ZimeV.Value)
local pos = CFrame.new(Vector3.new(ZimeV.Value))
end
end)
This will check whenever the Value property of the Vector3Value changes, and it will check if the value is equal to 0,0,0 or not. But, this won't run the first time, as the value doesn't change, it will run each time after the value changes.
Hope this helped! If this worked for you, let me know by selecting this as the answer!
2 comments
Are there any errors?
Not receiving errors but only the "Wrong Value Wait" is appearing in output.