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!
