Files
PlaneBuilding/scripts/gui/ExpansionScript.lua
T

26 lines
959 B
Lua

local defaultPosition = script.Parent.Saves.Position
local defaultSize = script.Parent.Saves.Size
local expandedPosition = UDim2.new(0.5,-defaultSize.X.Offset,0,defaultPosition.Y.Offset)
local expandedSize = UDim2.new(0,defaultSize.X.Offset*2,0,defaultSize.Y.Offset)
local toggle = false
local input = game:GetService("UserInputService")
local function expansion()
toggle = not toggle
local newSize = defaultSize
local newPosition = defaultPosition
if toggle then
newSize = expandedSize
newPosition = expandedPosition
end
script.Parent.Saves:TweenSizeAndPosition(newSize,newPosition,Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,0.5,true)
end
input.InputEnded:Connect(function(input,irrelevant)
if not irrelevant and script.Parent.Enabled then
if input.UserInputType == Enum.UserInputType.Keyboard then
if input.KeyCode == Enum.KeyCode.E then
expansion()
end
end
end
end)
script.Parent.MinimizeButton.Activated:Connect(expansion)