local frame = script.Parent.Parent:WaitForChild("Frame")
local open = script.Parent.Parent.Open
Player = game.Players.LocalPlayer
Mouse = Player:GetMouse()
function PressI(key)
if (key == "x") then
if open.Value == false then
frame:TweenPosition(UDim2.new(0.243,0,0.127,0),"Out","Quint",1,true) -- Position of your frame when its opened
open.Value = true
elseif open.Value == true then
frame:TweenPosition(UDim2.new(0.243,0,-0.127,-401),"Out","Quint",1,true) -- Position of your frame when its closed
open.Value = false
end
end
end
Mouse.KeyDown:connect(PressI)
Use UserInputService.
Here's an example. ```lua
local Keycodes = Enum.KeyCode --For easier reference. local Up = true; game:GetService('UserInputService').InputBegan:Connect(function(Key, Process) if (Process) then return end --If the player is in the menu, or a frame with Modal is present, then don't continue. Key = Key.KeyCode --Reassign key to it's keycode.
if (Key == Keycodes.E) then if (not Up) then script.Parent:WaitForChild('Frame'):TweenPosition(UDim2.new(0,0,-1,0), Enum.EasingDirection.InOut, Enum.EasingStyle.Sine, 1, true) --Tween a frame upwards Up = true else script.Parent:WaitForChild('Frame'):TweenPosition(UDim2.new(0,0,0,0), Enum.EasingDirection.InOut, Enum.EasingStyle.Sine, 1, true) --Tween a frame back down Up = false end end
end) ``` If something's giving you a nil value, it's most likely the BoolValue. Try using WaitForChild on the "open" variable.