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

How can i add until "x" reaches -200?

local i2 = script.Parent
local i1 = script.Parent.Parent.ImageButton1
local i3 = script.Parent.Parent.ImageButton3
local frame1 = script.Parent.Parent
local frame2 = script.Parent.Parent.Parent.Frame2

function onClick(i2)
	for i = -0.1,200 do
		i1.Position = i1.Position + UDim2.new(0,-0.1,0,0)
		wait(0.12)
		end
	end
		
	
	i2.MouseButton1Click:connect(onClick)
	

7 comments

0

I don't understand your question, what is 'equalize'?

0

I want to add a higher value to x, but i don't know how, i'm just saying make it -0.1 instead of from -0.1 to all they way to -200

0

???

0

I'm loosing Rep because nobody understand what i'm saying, i want to increase the "x" value from -0.1 to -200, ALL THE WAY.

0

Then why not just do '...UDim2.new(0,-200,0,0)'?

0

I want the code to execute 200 times per each 0.12 seconds while adding -0.1 to the "x" value till it reaches -200

0

I'm pretty sure the shortest amount of wait() time is 30 times a second. I don't think it's possible to do it 200 times in .12 seconds.

1 answer

Try this.

local i2 = script.Parent
local i1 = script.Parent.Parent.ImageButton1
local i3 = script.Parent.Parent.ImageButton3
local frame1 = script.Parent.Parent
local frame2 = script.Parent.Parent.Parent.Frame2

function onClick(i2)
repeat
i1.Position = i1.Position + UDim2.new(0,-0.1,0,0)
wait(0.12)
until i1.Position >= -200
end

i2.MouseButton1Click:connect(onClick)

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