Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

This isn't working? (Inventory GUI)

Asked by 9 years ago

I'm trying to make a Custom Inventory GUI, and I'm making it detect the position of where it is, to tell if it's going to open or not. But for some reason it isn't working. Please help!

-- InventoryHandler
-- MLGsLoveMtnDew

                    ----[Local Variables]----
                    Player  =game.Players.LocalPlayer;
                    Mouse   =Player:GetMouse();
                    ----[GUI Variables]----
                    InventoryOverlap    =script.Parent;
                    InventoryIcon   =InventoryOverlap:WaitForChild("InventoryIcon");
                    InventoryMain   =InventoryOverlap.Parent:WaitForChild("InventoryMain");
                    ----[Images]----
                    InventoryClosed ="http://www.roblox.com/asset/?id=267375889"
                    InventoryOpened ="http://www.roblox.com/asset/?id=267375860"
                    ----[Mouse Icons]----
                    MouseDefaultIcon    ="http://www.roblox.com/asset/?id=265193813"
                    MouseHoverIcon  ="http://www.roblox.com/asset/?id=265196119"
                    MouseClickIcon  ="http://www.roblox.com/asset/?id=265561302"
                    MouseInventoryIcon  ="http://www.roblox.com/asset/?id=267378716"    


InventoryIcon.MouseButton1Click:connect(function()
    if InventoryIcon.Position == UDim2.new(-2, 0, -5, 0) then
        InventoryMain:TweenPosition(UDim2.new(-2, 0, 1.2, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Bounce, 2, false)
    elseif InventoryIcon.Position == UDim2.new(-2, 0, 1.2, 0) then
        InventoryMain:TweenPosition(UDim2.new(-2, 0, -5, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Back, 2, false) 
    end
end)
Mouse.KeyDown:connect(function(key)
if key == "e" then
    if InventoryIcon.Position == UDim2.new(-2, 0, -5, 0) then
        InventoryMain:TweenPosition(UDim2.new(-2, 0, 1.2, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Bounce, 2, false)
    elseif InventoryIcon.Position == UDim2.new(-2, 0, 1.2, 0) then
        InventoryMain:TweenPosition(UDim2.new(-2, 0, -5, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Back, 2, false) 
    end
    end
end)

Thank you!

1 answer

Log in to vote
0
Answered by
pwnd64 106
9 years ago

Try making a variable that is set to false by default, and when the player clicks it it checks if it's false/true, and makes it the opposite and then makes the shop/whatever you want to open visible. Does that make sense?

Ad

Answer this question