Gui:TweenPosition zaps to the next position instead of tweening

I’m making a script that tweens GUIs, but it just teleports with no tweening. Why is this?

gui:TweenPosition(UDim2.new(0.5,0,0.5,0),guiModule.Enum.EasingDirection.InOut,Enum.EasingStyle.0.5,true)

For more clarification, it appears in the top-left corner (og position is middle of screen out of sight) and instantly teleports to the middle when the time is up.

Are you tweening a gui or a basepart?

I am tweening a GUI (frame). I didn’t clarify it too much.

What do you want it to do? Like move it, scale it, etc.

Please, read the code. It’s GUI:TweenPosition()

gui:TweenPosition(UDim2.new(0.5,0,0.5,0), "InOut", "Sine", 0.5, true)

Try this instead, let me know how it goes.

You can just change the gui position with udim2 yourself

@detourious No, it just snaps still.
@Spellwastaken I want to tween it. That’s why I’m using TweenPosition.

This part isn’t right. There should probably be errors, right?

Anyways, follow what @detourious sent.

Send your code, this worked fine on my side.

It originally referenced a module here, I just edited the code in Devforum, hold on.
@detourious Here’s the module code:

	-- Time it takes
	Time = 0.5,
	
	-- Easing Style
	EasingStyle = "Cubic",
	
	-- Easing Direction
	EasingDirection = "InOut",
	
	-- Won't work, not included in tween function
	repeatAmount = 0,
	
	-- Won't work, not included in tween function
	repeats = false,
	
	-- Won't work, not included in tween function
	delayTime = 0
}

Script code:

guiModule.TweenParent:TweenPosition(guiModule.TweenIn,guiModule.TweenInfo.EasingDirection,guiModule.TweenInfo.EasingStyle,guiModule.TweenInfo.Time,true)

Even if it did, what’s the point

… of this?

This part is wrong.

This seems awfully complex for just a simple tween. Anyway, you should just run :TweenPosition() on whatever you want to tween.

1 Like

Point: Bad DevForum editing, lol

@detourious It’s for a client, the module is for easy editing.

Still. It’s just a tween. If you want to use it again and again, then just make it a variable. Module Scripts for a simple tween doesn’t make too much sense.

2 Likes

The module includes the button to invoke the tween, and the thing to tween, as well as in/out tween values. It makes sense for me

I understand. In my opinion, it seems pointless to do that, but to each their own, I guess.

Try replacing the code that references the module with what I sent & send some more code.

1 Like

Alright. Then just follow this code:

gui:TweenPosition(UDim2.new(0.5, 0, 0.5, 0), guiModule.EasingDirection, guiModule.EasingStyle, 0.5, true)
1 Like

That won’t work because he didn’t share the entire module. There’s another TweenInfo table that he indexes, so this would error. Unless it doesn’t, then I don’t know.

1 Like

It works. Thanks, I’ll make sure to figure out how to do this.

2 Likes