Advertisement
Guest User

Roblox srip to making games

a guest
Feb 24th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. YouTube|id=PCbP-v_edpk}}-->{{#widget:YouTube|id=PCbP-v_edpk}}
  2.  
  3. We will often need to do math while scripting. Lua supports all the basic mathematical operations. For example, if we want to print the result of adding two numbers, all we have to do is:
  4.  
  5. > print(7 + 3)
  6. 10
  7.  
  8. We print all kinds of operations:
  9.  
  10. > print(10 + 5)
  11. 15
  12. > print(10 - 5)
  13. 5
  14. > print(10 * 5)
  15. 50
  16. > print(10 / 5)
  17. 2
  18.  
  19. We can also perform math on numbers stored in variables.
  20.  
  21. > myNumber = 5
  22. > print(myNumber + 2)
  23. 7
  24.  
  25. We can even store the result of operations into a variable:
  26.  
  27. > sum = 25 + 8
  28. > print(sum)
  29. 33
  30.  
  31. In the [[Scripting 2|next tutorial]] we will cover how to change the properties of parts through code.
  32.  
  33. {{Tutorial|topic=scripting|next=Creating Parts via Code}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement