for i =
db =
^^^^^^^^ What do these do
"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:
For i=1, 10 do print(i) wait(1) end
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:
debounce = false -- immediately, I tell the script "hey, make a boolean (true-or-false) value. It's called debounce. Remember it, I'll need it later!" function onTouched(hit) -- see the end of the code for what activates this function if debounce == false then -- two equals signs means "is equal to". debounce = true -- i tell the script that debounce is now true instead of whatever it used to be. Thanks to the above "if" statement, the touch script now gets ignored by any other activations until we turn the debounce variable back to false. -- your code goes here. debounce = false end end script.Parent.Touched:Connect(onTouched) -- aha! whenever the brick this script is in is touched, this function "onTouched" runs.
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!