PROBLEM: I was trying to make it so if I press a certain key the gui will slide onto the screen (using gui animations) but it didnt work can anybody help to try to figure out the problem plus im a starter to scripting.
local Frame = script.Parent.Frame local Box = Frame.Box local Button = Frame.Button Player = script.Parent.Parent mouse = Player:GetMouse() local Animate = function(Frame, EndPos, EndSize, Direction, Style, Time, OR, Type) -- Frame, UDim2, easingDirection, easingStyle, float [time], bool [override], TypeOfAnimation if Type == "Position" then return Frame:TweenPosition(EndPos, Direction, Style, Time, OR) elseif Type == "Size" then return Frame:TweenSize(EndSize, Direction, Style, Time, OR) elseif Type == "SizeAndPosition" then return Frame:TweenSizeAndPosition(EndPos, EndSize, Direction, Style, Time, OR) end end function onKeyDown(key) key = key:lower() if script.Parent.Open.Value == false then if key == "e" then Box.Position = UDim2.new(-2,0,0,0) Animate(Box,UDim2.new(0.150,0,0,0), UDim2.new(0.25, 0, 0.25, 0), "Out", "Back", 2, true, "Position") end end end mouse.KeyDown:connect(onKeydown)