Hello! I’m trying to make it so when I hit “Y” on my keyboard a Frame named “Phone” will move upward until on the players screen. When they close it, the Frame will move downwards then go invisible. I have the UserInputService script but I just need assistance with the Tween script.
Thanks.
You can connect UserInputService events to a function that tweens the frame.
local TS = game:GetService("TweenService")
local UIS = game:GetService("UserInputService")
local phoneFrame = script.Parent
local myTweenInfo = TweenInfo.new() --insert your tweeninfo here
local goals = {} --insert your Position in UDim2 here
UIS.InputBegan:Connect(function()
local myTween = TS:Create(phoneFrame, myTweenInfo, goals)
myTween:Play()
print("now the phone slides up smoothly!")
end)
For more information about how to use tweens, refer to Tween and scroll down to bottom for examples. Refer to TweenService for more examples, or if you just wanna learn the API too.
1 Like