Use TweenPosition to smoothly move the Image up and down. You will also need to make a bool variable to determine if it’s open or closed. Example, say this is in a localscript inside of that image
local image = script.Parent
local open = false
local closePos = --UDim2 of where the image should go when closed
local openPos = --UDim2 of where the image should go when opened
image.MouseButton1Click:Connect(function()
local chosenPos = open and closePos or openPos
image:TweenPosition(chosenPos, Enum.EasingDirection.InOut, Enum.EasingStyle.Linear, 0.5, true)
open = not open
end)
Basically just move the RadioImage where you want, go into its properties and in the Position property, there are 4 numbers, those are the 4 values t o put into an UDim2. Say you want it go up at 0.5 on the Y scale and 0.2 on the X scale, just do
You need to replace ScreenGui with a reference to your actual screengui object. E.g. if the code is pasted in a LocalScript that’s parented to a screengui object, you would do script.Parent.
If you’re not sure about what a “reference to an object” is, this resource here might be of use to you : Learn Roblox
Did you put it so that the Radio image starts off closed? If so, you could try this out
local image = script.Parent
local open = false
local pos = image.Position
local closePos = pos
local openPos = UDim2.new(pos.X.Scale,pos.X.Offset,pos.Y.Scale - 0.1, pos.Y.Offset)
image.MouseButton1Click:Connect(function()
local chosenPos = open and closePos or openPos
image:TweenPosition(chosenPos, Enum.EasingDirection.InOut, Enum.EasingDirection.Linear, 0.5, true)
open = not open
end)
So it makes the closePos the original position of the radio and the openPos the position of the radio but with a decrease so it goes up as an example
Again, localscript inside of that radio ImageLabel, you will need to convert the ImageLabel to an ImageButton for this to work, there should be a plugin to easily convert that for you, such as
It depends on where your script is located and where your ScreenGui object is located. This tutorial here (Learn Roblox) is a good place to learn the basics of referencing objects in your game while also manipulating them, through code.
local image = script.Parent
local open = false
local pos = image.Position
local closePos = pos
local openPos = UDim2.new(pos.X.Scale,pos.X.Offset,pos.Y.Scale - 0.1, pos.Y.Offset)
image.MouseButton1Click:Connect(function()
local chosenPos = open and closePos or openPos
image:TweenPosition(chosenPos, Enum.EasingDirection.InOut, Enum.EasingStyle.Linear, 0.5, true)
open = not open
end)