How Do I Make Gui Slide In When Hovered On It?

Hello Everyone, I’m Trying To Create Gui That Slides In When You Hover On It And Then Slides Back When You Move Cursor Out Of Its Range.

I Tried Everything But I’m Kinda Still New To This And Hoped You Guys Would’ve Helped Me. Thank You For Reading!

3 Likes

I would use the “MouseEnter” and “MouseLeave” event to to achieve such an effect you can just do it like this:

local TweenService = game:GetService("TweenService")
local TweenInfo = TweenInfo.new(0.3, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)

local Hitbox = script.Parent
local GuiToMove = script.parent.textlabel
local OriginalPosition = Hitbox.Position
local Offset = Vector3.new(2, 0, 0)

local MoveRight = TweenService:Create(GuiToMove, TweenInfo, { Position = OriginalPosition + Offset })
local MoveBack = TweenService:Create(GuiToMove, TweenInfo, { Position = OriginalPosition })

Hitbox.MouseEnter:Connect(function()
    MoveRight:Play()
end)

Hitbox.MouseLeave:Connect(function()
    MoveBack:Play()
end)
2 Likes

Oh thank you! But, I’ve made some changes with some website:

local TweenService = game:GetService("TweenService")
local TweenInfo = TweenInfo.new(0.3, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
 
local Hitbox = script.Parent
local GuiToMove = Hitbox.[Name Of Thing You Want To Move]
local OriginalPosition = GuiToMove.Position -- Changed to GuiToMove
local Offset = UDim2.new(0.1, 0, 0, 0) -- Changed to UDim2
 
local MoveRight = TweenService:Create(GuiToMove, TweenInfo, { Position = OriginalPosition + Offset })
local MoveBack = TweenService:Create(GuiToMove, TweenInfo, { Position = OriginalPosition })
 
Hitbox.MouseEnter:Connect(function()
    MoveRight:Play()
end)
 
Hitbox.MouseLeave:Connect(function()
    MoveBack:Play()
end)
2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.