I need to stop one of my tweens. When I first run this script it creates a tween, let’s call it “Bacon”. But when I run this script a second time it creates another tween, let’s call it “Eggs”. “Bacon” is still running but I’m not able to stop it because I already created “Eggs” and the script registers upTween as “Eggs”. So if I use upTween:Pause() it’s going to stop “Eggs”. But I need “Bacon” to be stopped. Is there a way I can do that? (I can’t create a second upTween because I need specific conditions but if you can prove me wrong please do so.)
local TweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(1)
local upTween = TweenService:Create(charAttachment, tweenInfo, {
Position = Vector3.new(charAttachment.Position.X, 1.5, charAttachment.Position.Z),
Orientation = Vector3.new(charAttachment.Orientation.X, charAttachment.Orientation.Y, -5)
})
And how exactly would I do that? If I put :Cancel before upTween then obviously upTween will register as nil because it haven’t been defined yet. I think I’ve been misunderstood.
--stuff
local TweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(1)
local upTween = TweenService:Create(charAttachment, tweenInfo, {
Position = Vector3.new(charAttachment.Position.X, 1.5, charAttachment.Position.Z),
Orientation = Vector3.new(charAttachment.Orientation.X, charAttachment.Orientation.Y, -5)
})
--stuff
The tween isn’t duplicated inside the script. The script itself runs twice. And I want to stop the first tween that has been created, not the second one.