Answered by
7 years ago Edited 7 years ago
"For i=" is the beginning of a loop statement.
A "for" loop counts up to the number you specify.
the "i=" is the variable that equals how many loops have been completed so far.
here's an example:
this code would print 1 and wait a second, then 2 and wait a second, then 3, counting all the way up to ten as it went over the loop.
Read this for a better explanation, and some more useful loops.
"DB" is just a variable. it stands for "debounce", but the name isn't important as it's just a the usual name used by scripters. The only important part is that your debounce value starts equaling "false".
Debounce involves setting a true-or-false statement to ignore repeated inputs on a script. This is usually if you have a button that you don't want excited players pressing over and over and over in quick succession, or giving a gun a "reload" time immediately after firing.
The way you use debounce is:
03 | function onTouched(hit) |
04 | if debounce = = false then |
12 | script.Parent.Touched:Connect(onTouched) |
remember that the debounce variable is just a true/false value you're asking the script to remember. it can be called anything. "MyButt" is a good choice- hard to forget when starting out! :P
These are fairly base-level concepts of scripting, though. I recommend looking at some beginner tutorials on the roblox wiki, or the Roblox cookbook (link), which is the way I learned.
Hope this helped!