Hello,
The Lerp code did work for a long time, but I now have problems?
armor = Lerp(10 * FrameTime(), armor, LocalPlayer():Armor())
[ERROR] lua/includes/util.lua:237: attempt to perform arithmetic on local 'from' (a function value)
1. Lerp - lua/includes/util.lua:237
2. v - lua/autorun/client/cl_hud.lua:120
3. unknown - lua/includes/modules/hook.lua:84
Thanks in advance!
Your "armor" variable is a function, not a number.
Thanks!
It worked but then saved my file and it's giving the same error? But it worked before?
sAR = Lerp(10 * FrameTime(), sAR, LocalPlayer():Armor())
Somewhere in that file you're setting that variable to a function.
That's the whole problem. There is not variable that "connects" to a function. Checked everything.
It's strange tho, because it worked before with the same code and now it doesn't work?
Can you post the full code?
[Lua]
You are not declaring sAR anywhere. So when it first tries to Lerp it, sAR is nil. Localize it somewhere, and also declare other variables like health, or your code will throw out errors about having nil values.
That shouldn't be the issue at all, because the code worked before? I cleared up my code a bit and tryed to remove as many health and armor variables.
But as I thought still does not work?
[Lua]
It's better if you listen and try it instead of blindly arguing against their suggestions.
try this
sAR = Lerp(10 * FrameTime(), sAR or 0, LocalPlayer():Armor())
I am sorry for my reactions, but I am trying to learn Lua so it's sometimes frustrating when a code doesn't work and you can't find the solution. Thank you for helping me, I will try to code right a way!
Really? Took everybody an hour to understand everything, so you must be stupid.
Hehehehehe, code worked!
Sorry, you need to Log In to post a reply to this thread.