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

How to make Shaky ImageLabel?

Asked by 9 years ago

I'm wanting this to move in random coordinates. Small coordinates to the point where as if it was shaking.

for i = 1, 10 do
    SSLogo.Position = UDim2.new(0, i + 0.01, 0, i - 0.01)
    wait()
end

1 answer

Log in to vote
2
Answered by 9 years ago

A solution that is more practical is to use math.sin and tick().

while wait() do
    SSLogo.Position = UDim2.new(0, 0, 0,  math.sin(tick() * 10) * 2)
end

EXPLANATION?

Math.sin always returns an number between -1 and 1, as used in Trigonometry, so I use tick, because it's value always changes. I've multiplied it by 10 so the Logo can shake more vigorously.

Then, I've multiplied the final value by 2, so it moves two pixels instead of 1.

Ad

Answer this question