so I have been dabbling in lua... again... and tried to make a simple script.
Basically, this script should:
1. see is W is being held
2. if W is being held, do some random math
3. make x = whatever the random number is
4. check the number, if x == 100 then
5. while W is held, gib the actor(or object) it is connected to
6. if it does NOT = 100, print a message telling me what it was.
Now I know the likelyhood of a random number being 100 is very, very slim. But that is not the point, the point is to get anything to happen at all.
I am rather sure I am going about this all wrong.
here is the code:
Code:
if UInputMan:KeyHeld(23) then
   x = math.random
   print(x)
end
function Update(self)
   if x == 100 then
      while UInputMan:KeyHeld(23)
         do self.Gibthis
      end
   end
   elseif x ~= 100 then
      print("The number was " x)
   end
end
I really don't know what the problem is... but like I said, I feel like something is wrong, I just cant tell what it is.
The error associated with it is that it expects a = next to the end at line 9... What do I do to fix this?