I'm working on a inventory system, but I don't like it just appearing, it looks ugly, So I want it to kind of, smoothly come out of the center, but it isn't working for me, The box doesn't appear when I test it Here's my code inside the frame:
CAS = game:GetService('ContextActionService')
function OpenInv(actionName, userInputState, inputObject)
if userInputState == Enum.UserInputState.Begin then
print('Open Inventory')
script.Parent.Visible = true
script.Parent.Position = UDim2.new(0.5, 0, 0.5, 0) -- We set the scales to .5, .5, which is the center of the screen
script.Parent.Size = UDim2.new(0,0,0,0) -- We set the frame size to 0, so it will pop out of the middle of the screen.
script.Parent:TweenSizeAndPosition(UDim2.new(0, 400, 0, 600), UDim2.new(.5, -200, .5, 600), "Out", "Quad", 1) -- This will change the size, from 0,0 to 400, 600, and the position will change so the frame stays centered.
end
end
function CloseInv(actionName, userInputState, inputObject)
if userInputState == Enum.UserInputState.Begin then
print('Close Inventory')
--i also want to use tweening here to make it smoothly go in
script.Parent.Visible = false
end
end
CAS:BindAction("invClose", CloseInv, false, Enum.KeyCode.R)
CAS:BindAction("invOpen", OpenInv, false, Enum.KeyCode.E)

1 comment
Thanks i'll try it