Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

simple but kinda noobie question?

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

1 answer

✓ Accepted answer

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

10 comments

0

sorry that did answer that question about for lets say cframe

0

can you provide more context, like some more code

0

so like for i = 0,1,.01 do cCFrame = c.CFrame:Lerp(finish,i) "from a scripting video" not explained well

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

0

https://wiki.roblox.com/index.php?title=CFrame#lerp or you can google cframe lerping if you're confused about that

0

so its a Cframe value's that it uses instead of a table

0

yep!

0

ok thanks :)

0

Answer also edited to include a CFrame example if you need it.

0

thanks :)

This discussion is preserved as it was. New answers, comments, and votes are closed.