Boolean within the same local script or an instance with class intvalue?

which is the most optimal? basically i use it inside a runservice to know if the player is walking, running or standing, i don’t know if it’s better to use:

if humanoid.WalkSpeed == correr.Value then 
--code 
end 

or

if humanoid.WalkSpeed == corriendo then


end 

A local variable is definitely more efficient when it comes to performance, but a value base doesn’t hurt, especially if you need it for other local/module scripts to access. Value base as an instance of course carries more data than a single locallized variable existing in the scope of the script. Once it’s parented to workspace, different engine functions and listeners are automatically connected. Should you be worried about performance issues in your case? Not at all.

the boolean is for the animations so I need the highest performance, if an exploiter does something about it the fool will damage itself.

Alright :slight_smile:. Just bear in mind that exploiters have full access on their machine (maybe Byfron limits it a little). They have a lot of freedom in any local script, so it’s not worth wasting too many resources for fighting exploits on client side. You also don’t have to update the variable/value base every frame, only when the change occurs.

Good luck!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.