How to use local variables?

Hello,

I tried changing my variables to local variables so I wouldn’t need to change for every duplicated function but I got the error message:

“Variable set (local variable) uses an invalid target. It may depend on a node that is not connected to the execution chain and got purged
Property associated with (local variable) could not be found in (project)”

It is strange because everything is connected and it was working with normal variables.

It’s hard to say blindly what is going on. But Local variable is the variable defined only for the current function. Which means it cannot be used outside. So the way you use them is to read them only within the function. You just probably have to delete the “set” of the variable and add new one.

I use the local variables only inside the function, and those are setting a normal variable which is used outside. Is is a problem? I will try placing the set nodes again for the local variables but I got the same error for local array variables which are doesn’t have a set node

Local variable cannot set anything, and should not directly connect to the global one, as it looses purpose then. This is more of a programming thing. There is not right or wrong here.