I’m currently trying to make a area system with a fancy tween in and out effect for coming in contact with the area. But when I enter another area the tweens become really buggy as it passes on from the previous tweens and the new ones.
I’m wondering if there’s a way to cancel the first tween so that it doesn’t do this (notice: i’m using a tween with a wait after it)
Example of a working system: Roblox - Gyazo
function NewLocation(RegionName)
local Region = GetInfo[RegionName]
local Main = script.Parent.Cover.main
local Description = script.Parent.Cover.sub
Main.Text = Region.title
Description.Text = Region.subtext
TweenService:Create(game.Lighting, TweenInfo.new(2, Enum.EasingStyle.Cubic, Enum.EasingDirection.Out), {
FogEnd = Region.fogend;
FogColor = Region.fogcolor
}):Play()
for i,v in pairs(script.Parent.Parent.Base:GetDescendants()) do
if v:IsA("TextLabel") then
TweenService:Create(v, TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {
TextTransparency = 0;
TextStrokeTransparency = 0.6
}):Play()
end
end
TweenService:Create(script.Parent.Parent.Base, TweenInfo.new(1, Enum.EasingStyle.Cubic, Enum.EasingDirection.Out), {
Size = UDim2.new(0,Description.TextBounds.X,0,100)
}):Play()
task.wait(5)
for i,v in pairs(script.Parent.Parent.Base:GetDescendants()) do
if v:IsA("TextLabel") then
TweenService:Create(v, TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {
TextTransparency = 1;
TextStrokeTransparency = 1
}):Play()
end
end
TweenService:Create(script.Parent.Parent.Base, TweenInfo.new(1, Enum.EasingStyle.Cubic, Enum.EasingDirection.Out), {
Size = UDim2.new(0,0,0,100)
}):Play()
end