Tweening broke?

I don’t think there’s anything wrong with my script, but when I call it this happens:
https://gyazo.com/9c08fe84e2e62525e0855e5df7a7ea93
It doesn’t tweens, it just pops up e_o
code:

local function TweenOut(frame)
	frame:TweenPosition(UDim2.new(0,0,-1,0), 'InOut','Exponential',1,false)
	coroutine.wrap(function()
		yield(1)
		frame.Position = UDim2.new(0,0,1,0)
	end)
	return true
end


local function TweenIn(frame)
	frame:TweenPosition(UDim2.new(0,0,0,0), 'InOut','Exponential',1,false)
	return true
end

Whenever I do tweens I refer to the EastingStyle and EastingDirection using the Enum. So in your use it would be Enum.EasingStyle.Exponential and Enum.EasingDirection.InOut. I’m not sure if this is the definitive solution but since the object is moving I would think the source of the issue to be in the TweenInfo. But I may be wrong since the DevForum seems to not use Enums when you’re tweening objects outside of the TweenService.

You didn’t call the coroutine yet:

coroutine.wrap(function()
	yield(1)
	frame.Position = UDim2.new(0,0,1,0)
end)() -- Call it! Notice the 2 extra brackets

Tweenposition shouldn’t be used, as TweenService is much better. You don’t even need coroutines for delayed tweens for tweenservice:

local TS = game:GetService("TweenService")
local TI = TweenInfo.new(1, Enum.EasingStyle.Constant, Enum.EasingDirection.Out, repeatamount, reverses, delay)

TS:Create(frame, TI, {Position = UDim2.new(0,0,1,0)}):Play()
1 Like