I'm making a simulator game where at the start your only way of getting coins is by clicking a button. I am trying to make it so that when you click the button it bounces up then down every click. Does anyone know how?
COMMUNITY QUESTION
How do I make an ImageLabel Go up then down when you click it?
2 answers
Take A Look At The Roblox DevForum It Should Help You:
https://developer.roblox.com/en-us/api-reference/function/GuiObject/TweenSizeAndPosition
Try this code, Use an ImageButton instead of ImageLabel
local debounce = false
local PosToMove = UDim2.new(0,20,0,20) --Position to move when clicked
local OtherPosTM = UDim2.new(0,50,0,50) --Back to its original position
script.Parent.MouseButton1Click:Connect(function()
If not debounce then
debounce = true
script.Parent:TweenPosition(PosToMove,
Enum.EasingDirection.InOut, --Or other
Enum.EasingStyle.Bounce, --You want bounce isnt it?
1.5, --The duration of the tween
end)
wait(1) --Wait a second before tweening again
script.Parent:TweenPosition(OtherPosTM,
Enum.EasingDirection.InOut, --Or other
Enum.EasingStyle.Bounce, --You want bounce isnt it?
1.5, --The duration of the tween
wait(0.5) --Wait so you can deactivate the debounce
debounce = false
end)
TweenPosition is a function used mostly to animate GUIS, the first parameter is where to move to, the other parameter is the EasingDirection, next, the EasingStyle and the duration.
If you want more information go see page: https://developer.roblox.com/en-us/api-reference/function/GuiObject/TweenPosition
Hope it helps!
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
use tweening