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

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

Asked by
Xianon 105
10 years ago
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)

0
I don't understand your question, what is 'equalize'? adark 5487 — 10y
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 Xianon 105 — 10y
0
??? Perci1 4988 — 10y
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. Xianon 105 — 10y
View all comments (3 more)
0
Then why not just do '...UDim2.new(0,-200,0,0)'? Perci1 4988 — 10y
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 Xianon 105 — 10y
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. Perci1 4988 — 10y

1 answer

Log in to vote
0
Answered by
TopDev 0
10 years ago

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)

Ad

Answer this question