Idk why, but this won’t run at all. Does anyone know how to do this tween correctly? I know you can use tweenservice I’m aware. I want my frame to pop out from the middle of the screen. You can’t do this with tweenservice, because it picks a side the frame tweens out from.
function tween(frame,t1,t2)
spawn(function()
for i = 1,t2,.1 do
frame.Size = frame.Size + UDim2.new(0,0,i,0)
wait()
end
end)
spawn(function()
for i = 1,t1,.1 do
frame.Size = frame.Size + UDim2.new(i,0,0,0)
wait()
end
end)
end
while wait(6) do
local frame = script.Parent:WaitForChild("levelFrame")
frame.Size = UDim2.new(0,0,0,0)
tween(frame,.25,.3)
end
There are a number of problems / areas of concern with your code, but only one real logic error. Based on the arguments you called tween with, your code will end up doing two for loops as follows:
for i = 1, .3, .1 do
and
for i = 1, .25, .1 do
Neither of these will run for any iterations because .3 and .25 are both smaller than 1, the initial value in the loop.
This is an appropriate scenario to use TweenService. You can use AnchorPoint to control the point from which the Frame will get scaled. For example, if you set this to (0.5, 0.5), then any scaling you perform will take effect from the center of the Frame.