How to Stop A Tween

Hello There, I made this post for a problem i faced. I had made a post on tweening a checkpoint, and i wanted it to tween if it was the next stage i had to reach.
Yes the problem was solved but a new problem arises, and that is to stop a tween.
ik the functions - tween:Create() , tween:Pause() , tween:Cancel(),
But Im Not Sure How to Implement Them Correctly.
##Sumerization##
I want the checkpoint to tween once and only once.but if you reset your progress it tweens again.
Heres a game i brought a few of the assets on so you can see what i mean - Untitled Game - Roblox
Ill leave it uncopylocked if you directly want to edit it,
Thanks

Assign the tween to a variable, like so:

local Tween = TS:Create(tweenstuffhere)

Tween:Play() - Starts / resumes your tween
Tween:Stop() - Stops your tween
Tween:Pause() - Pauses your tween

Just make sure you give it a variable so you can call multiple different actions on it, eg: playing, pausing, stopping.

local TS = game:GetService("TweenService")
local TInfo = TweenInfo.new(0.5, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut)
local Tween = TS:Create(workspace.Part, TInfo, {Position = Vector3.new(100,100,100})


Tween:Play()
1 Like

i did tween that with a variable i just want it to tween once and then the script ends

also is Tween:Stop() a function???

use the wiki for these sorts of questions ^^

there’s a pause and a cancel function, pause will allow you to use play again from the position it was at when you paused, cancel will reset the tweens variables and start it from the beginning.

Tween:Cancel()
Tween:Pause()

If you want to check if tween has done then use Tween.Completed:Wait()

And yes this can be used as function!

1 Like

see ik what the function does an all but the problem i am facing is i want it to tween once.
like how do i do that with waiting or anything- also how do i do that without deleting or disabling the script after tweening

Anything that has () or uses “:” IS a function. Functions run code and can give you info from them, you can also pass info to functions inside the ().

If it doesn’t contain (), then it isn’t a function

yea but tween:Stop() Isnt a function for tweenservice any other way of stopping a tween without waiting

I’m confused? Can you elaborate?

Wait Can you join this i imported the items i needed to fix i can explain it to you on here - Untitled Game - Roblox

wait i think i found out how to do it, i disabled the script after the tween so it only tweens once

Tween is like a sound, you can Play, Pause and Cancel, and some other stuff

local Tween = TweenService:Create(...) -- Create a Tween

--// Functions
Tween:Play() -- Plays the tween. If tween is paused, tween continues where it was paused
Tween:Pause() -- Pauses the tween
Tween:Cancel() -- Stops the Tween, and resets to the start

--// Events
Tween.Completed -- Fires when the tween has finished playing

it is not a function for TweenService, but it is a function for a tween. TweenService is used to create a Tween and some other stuff

1 Like