How to make a gui object rise when clicked

If I were to make it, when you click it, aswell as going on screen, this audio plays (rbxassetid://6066104082). How would I do that?

Put a Sound instance in the ImageButton with that id and just add some code around

local image = script.Parent

local open = false

local pos = image.Position

local audio = image.Sound

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)
	audio:Play()
	open = not open
end)

Sound is the name of the sound instance in the ImageButton, you’d have ot rename it if you change the name of it

1 Like

How do I make it that it only plays when opening it

Just put in a condition that only plays it if it’s not open

local image = script.Parent

local open = false

local pos = image.Position

local audio = image.Sound

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)
	if not open then audio:Play() end
	open = not open
end)

Sorry to make this worse for you again but how could I make it that the GUI only appears when sat on a certain VehicleSeat?

@EmbatTheHybrid :pensive:

hastobe30characters

Put a script inside of the seat and detect changes to its occupant property via the GetPropertyChangedSignal("Occupant") event. I think we have to move this to messages since this unrelated to this post.