I have other scripts that places an object near the player and I then holds that position in a Vector3 value which is named "ZimeV". I want it to grab the value out of ZimeV and place this object there. I keep recieving 0,0,0 so I supposed that it's just not updating, so I changed it and still no luck. Any help?
if ZimeV.Value == Vector3.new(0,0,0)then print("Wrong Value Wait") ZimeV.Changed:Connect(function(Val) print("Found New Value"..Val) local pos = CFrame.new(Vector3.new(Val))
.Changed does not pass the current value as a parameter, it passes the property name. I'm not sure if this will fix your problems with updating the value, but it should be
if ZimeV.Value == Vector3.new(0,0,0) then print("Wrong Value Wait") ZimeV.Changed:Connect(function(Val) if Val == "Value" then print("Found New Value "..ZimeV.Value) local pos = CFrame.new(ZimeV.Value) end end) end
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!