-
I want my Inventory frame to tween closed after tweening open.
-
The Inventory frame only tweens open, and doesn’t work after.
LocalScript:
local TweenService = game:GetService("TweenService")
local Information = {
Inventory = TweenInfo.new(0.3,Enum.EasingStyle.Sine,Enum.EasingDirection.Out);
Settings = TweenInfo.new(0.3,Enum.EasingStyle.Sine,Enum.EasingDirection.Out);
}
local Goals = {
InventoryOpen = {
Position = UDim2.new(0.243, 0,0.178, 0);
};
InventoryClose = {
Position = UDim2.new(0.243, 0,-0.75, 0);
};
SettingsOpen = {
Position = UDim2.new(0.225, 0,0.499, 0);
};
SettingsClose = {
Position = UDim2.new(0.225, 0,-0.3, 0);
};
}
local Tweens = {
InventoryOpen = TweenService:Create(script.Parent.Parent.Inventory2,Information.Inventory,Goals.InventoryOpen);
InventoryClose = TweenService:Create(script.Parent.Parent.Inventory2,Information.Inventory,Goals.InventoryClose);
SettingsOpen = TweenService:Create(script.Parent.Parent.Settings,Information.Settings,Goals.SettingsOpen);
SettingsClose = TweenService:Create(script.Parent.Parent.Settings,Information.Settings,Goals.SettingsClose);
}
script.Parent.Inventory.Button.MouseButton1Down:Connect(function()
if script.Parent.Parent.Inventory2.Position == Goals.InventoryClose.Position then
Tweens.InventoryOpen:Play()
end
if script.Parent.Parent.Inventory2.Position == Goals.InventoryOpen.Position then
Tweens.InventoryClose:Play()
end
end)
script.Parent.Settings.Button.MouseButton1Down:Connect(function()
if script.Parent.Parent.Settings.Position == Goals.SettingsClose.Position then
Tweens.SettingsOpen:Play()
end
if script.Parent.Parent.Settings.Position == Goals.SettingsOpen.Position then
Tweens.SettingsClose:Play()
end
end)
If anyone has a solution, then please let me know.