I have minimal experience in tweenservice and made this script for an NpcChatGUI n’ I feel like its a bit long so I wondered if there was a way to compress it down a bit?
script.Parent.TextLabel:TweenSizeAndPosition(UDim2.new(0, 540,0, 50),UDim2.new(0.5, 0,0.613, 0), nil, nil, 1)
local tween1 = tweenService:Create(script.Parent.TextLabel, tweenInfo1, {TextTransparency = 0})
local tween2 = tweenService:Create(script.Parent.TextLabel, tweenInfo1, {BackgroundTransparency = 0.25})
local tween3 = tweenService:Create(script.Parent.TextLabel.NPCtalking, tweenInfo1, {BackgroundTransparency = 0.25})
local tween4 = tweenService:Create(script.Parent.TextLabel.NPCtalking, tweenInfo1, {TextTransparency = 0})
tween1:Play()
tween2:Play()
wait(2)
tween3:Play()
tween4:Play()
script.Parent.TextLabel.NPCtalking:TweenSizeAndPosition(UDim2.new(0, 530,0, 225),UDim2.new(0.499, 0,3.462, 0))
---Random codiing stuff here blah blah
local tween1exit = tweenService:Create(script.Parent.TextLabel, tweenInfo2, {TextTransparency = 1})
local tween2exit = tweenService:Create(script.Parent.TextLabel, tweenInfo2, {BackgroundTransparency = 1})
local tween3exit = tweenService:Create(script.Parent.TextLabel.NPCtalking, tweenInfo1, {BackgroundTransparency = 1})
local tween4exit = tweenService:Create(script.Parent.TextLabel.NPCtalking, tweenInfo1, {TextTransparency = 1})
print("Running exit animation")
script.Parent.TextLabel.NPCtalking:TweenSizeAndPosition(UDim2.new(0, 549,0, 10),UDim2.new(0.499, 0,0.892, 0), nil, nil, 0.8)
tween3exit:Play()
tween4exit:Play()
wait(0.5)
tween1exit:Play()
tween2exit:Play()
script.Parent.TextLabel:TweenSizeAndPosition(UDim2.new(0, 0,0, 0),UDim2.new(-1, 0,0.613, 0), nil, nil, 3.5)
Is there a better way to reduce the amount lines needed? (Yes, I know I should’ve turns script.Parent.TextLabel into a local variable but since Im planning to revamp the whole thing anyway I didnt bother to change it)