I was wondering how you achieve the effect below where a popup GUI slides in and out after a few seconds?
Just use TweenService and tween the position of the frame, wait a few seconds and tween it out again.
They set it’s position ouside the screen (Position = UDim2.new(-0.25, 0, 0.5, 0))
For the effect they use the TweenService like xM_MORT mentioned.
Example:(For this I’m going to use UserInputService)
local UIS = game:GetService("UserInputService")
local Frame = script.Parent.TextLabel
local Cooldown = false
UIS.InputBegan:Connect(function(Input, Chatting)
if Chatting then return end
if Cooldown == false and Input.KeyCode == Enum.KeyCode.E then
Cooldown = true
--Important Part VVV
Frame:TweenPosition(UDim2.new(0, 0, 0.5, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Elastic, 2)
task.wait(2.5)
Frame:TweenPosition(UDim2.new(-0.25, 0, 0.5, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Quart, 1)
--Important Part ^^^
Cooldown = false
end
end)
Then the results look like this
(Note):You can change the tweening and activation reason to touching a part or anything else.