So I have a local script tweening gui, with tween.Completed, but it fails, but if I make it like this, it works, do you guys know why?
– Not working using Tween.Completed
button.MouseButton1Click:Connect(function()
if opened.Value == "home" then
local tween = TweenService:Create(homeframe, TweenInfo.new(0.5, Enum.EasingStyle.Quint, Enum.EasingDirection.In), {Position = UDim2.new(-1, 0, .174, 0)})
local tweenbutton = TweenService:Create(homebutton, TweenInfo.new(0.5, Enum.EasingStyle.Quint, Enum.EasingDirection.In), {BackgroundTransparency = 1})
local tweentext = TweenService:Create(hometext, TweenInfo.new(0.5, Enum.EasingStyle.Quint, Enum.EasingDirection.In), {TextColor3 = Color3.fromRGB(255, 255, 255)})
local tweenline = TweenService:Create(homeline, TweenInfo.new(0.5, Enum.EasingStyle.Quint, Enum.EasingDirection.In), {Size = UDim2.new(0,0,0,0)})
tweenline:Play()
tweentext:Play()
tween:Play()
tweenbutton:Play()
tween.Completed:Connect(function()
local tween = TweenService:Create(settingsframe, TweenInfo.new(0.5, Enum.EasingStyle.Quint, Enum.EasingDirection.Out), {Position = UDim2.new(0, 0, .174, 0)})
tween:Play()
local tweenbutton = TweenService:Create(buttonframe, TweenInfo.new(0.5, Enum.EasingStyle.Quint, Enum.EasingDirection.Out), {BackgroundTransparency = 0})
tweenbutton:Play()
local tweentext = TweenService:Create(buttontext, TweenInfo.new(0.5, Enum.EasingStyle.Quint, Enum.EasingDirection.In), {TextColor3 = Color3.fromRGB(255, 194, 52)})
tweentext:Play()
local tweenline = TweenService:Create(buttonline, TweenInfo.new(0.5, Enum.EasingStyle.Quint, Enum.EasingDirection.In), {Size = UDim2.new(1,0,.07,0)})
tweenline:Play()
opened.Value = "settings"
end)
end
end)
But if I make it like this, using wait, it works. Sorry for the messy code.
button.MouseButton1Click:Connect(function()
if opened.Value == "home" then
local tween = TweenService:Create(homeframe, TweenInfo.new(0.5, Enum.EasingStyle.Quint, Enum.EasingDirection.In), {Position = UDim2.new(-1, 0, .174, 0)})
local tweenbutton = TweenService:Create(homebutton, TweenInfo.new(0.5, Enum.EasingStyle.Quint, Enum.EasingDirection.In), {BackgroundTransparency = 1})
local tweentext = TweenService:Create(hometext, TweenInfo.new(0.5, Enum.EasingStyle.Quint, Enum.EasingDirection.In), {TextColor3 = Color3.fromRGB(255, 255, 255)})
local tweenline = TweenService:Create(homeline, TweenInfo.new(0.5, Enum.EasingStyle.Quint, Enum.EasingDirection.In), {Size = UDim2.new(0,0,0,0)})
tweenline:Play()
tweentext:Play()
tween:Play()
tweenbutton:Play()
wait(.5)
local tween = TweenService:Create(settingsframe, TweenInfo.new(0.5, Enum.EasingStyle.Quint, Enum.EasingDirection.Out), {Position = UDim2.new(0, 0, .174, 0)})
tween:Play()
local tweenbutton = TweenService:Create(buttonframe, TweenInfo.new(0.5, Enum.EasingStyle.Quint, Enum.EasingDirection.Out), {BackgroundTransparency = 0})
tweenbutton:Play()
local tweentext = TweenService:Create(buttontext, TweenInfo.new(0.5, Enum.EasingStyle.Quint, Enum.EasingDirection.In), {TextColor3 = Color3.fromRGB(255, 194, 52)})
tweentext:Play()
local tweenline = TweenService:Create(buttonline, TweenInfo.new(0.5, Enum.EasingStyle.Quint, Enum.EasingDirection.In), {Size = UDim2.new(1,0,.07,0)})
tweenline:Play()
opened.Value = "settings"
end
end)