Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

simple but kinda noobie question?

Asked by 5 years ago
Edited 5 years ago

I see when people script they use I=0,1,0.1 my question is what is each place value mean

1 answer

Log in to vote
0
Answered by
dirk2999 103
5 years ago
Edited 5 years ago

It's part of a for function. Ex,

for i = 1,5 do
    print(i)
end

i will go from 1-5 in increments of 1, its default value.

Also i is just a variable, you can name it anything.

An example of a use for it,

for Variable = 0,1,.1 do
    ScreenGui.Frame.BackgroundTransparency = Variable --Changes the transparency to the variable that goes from 0 to 1 in increments of .1
    wait()
end

Also you can use it with tables,

Table = {1,2,3,"Bleh"}
for i = 1,#Table do
    print(Table[i])
end

CFrame example as requested,

for i = 0,15 do --Run 15 times, 0-15 in increments of 1
    Part.CFrame = Part.CFrame + Vector3.new(0,.2,0) --Add .2 studs to the CFrame of the part, every time this for loop runs, the part will go 3 studs all together (.2 * 15 = 3)
end

More information, RobloxDev ForLoops

0
sorry that did answer that question about for lets say cframe overkillerz1990 3 — 5y
0
can you provide more context, like some more code thebayou 441 — 5y
0
so like for i = 0,1,.01 do cCFrame = c.CFrame:Lerp(finish,i) "from a scripting video" not explained well overkillerz1990 3 — 5y
0
it's the same idea- i is a variable/a value that goes from 0 to 1 in 0.1 "increments" (so every time it adds 0.1 to itself), and then that variable is used to "Lerp" the CFrame thebayou 441 — 5y
View all comments (6 more)
0
https://wiki.roblox.com/index.php?title=CFrame#lerp or you can google cframe lerping if you're confused about that thebayou 441 — 5y
0
so its a Cframe value's that it uses instead of a table overkillerz1990 3 — 5y
0
yep! thebayou 441 — 5y
0
ok thanks :) overkillerz1990 3 — 5y
0
Answer also edited to include a CFrame example if you need it. dirk2999 103 — 5y
0
thanks :) overkillerz1990 3 — 5y
Ad

Answer this question