Hello world!
So my issue I’m having is trying to tween the frame from the middle,
example: In get a snack at 4 am, the objective frame would tween out from the middle, and then go back into the middle, then down. How do I achieve this?
My code so far (just tweens down then up)
local TweenService = game:GetService("TweenService")
local Event = game.ReplicatedStorage.Events:WaitForChild("popUpUI")
local plr = game.Players.LocalPlayer
local detector = game.Workspace.Cafe.Inside.Detector
detector.Touched:Connect(function(touched)
if touched.Parent == plr.Character then
script.Parent.Parent.Visible = true
Event:FireServer()
local newsize = UDim2.new(0, 785,0, 145)
local tweenInfo = TweenInfo.new(0.8, Enum.EasingStyle.Back, Enum.EasingDirection.In)
local tween = TweenService:Create(script.Parent.Parent, tweenInfo, {Size = newsize})
tween:Play()
task.wait(2)
local newsize = UDim2.new(0, 785,0, 0)
local tweenInfo = TweenInfo.new(0.8, Enum.EasingStyle.Back, Enum.EasingDirection.In)
local tween = TweenService:Create(script.Parent.Parent, tweenInfo, {Size = newsize})
tween:Play()
task.wait(1)
script.Parent.Parent.Visible = false
end
end)
You do not need to change your script as long as you set your AnchorPoint correctly.
Just in case you are not aware, the Anchor Point is from where on the UI object everything comes out of. If the Anchor Point is at 0.5, 0.5, it means any position or size you set will use the center of the object. With this said, if you were to change the size, it would grow / shrink in all directions.