I am trying to make an inventory GUI that should always be located just left of the far left edge of the player's screen (regardless of their screen size of course). The idea is that only an image button (part of the inventory frame) is sticking out from the left edge and when you click it, the whole thing moves right onto the screen. In testing mode this works fine, but in play mode (when my screen is full), the inventory GUI is nowhere to be seen. I guarantee this has to do with scaling, but I am unsure of how to fix it other than guessing and checking. Here's some of my code...
local TweenService = game:GetService("TweenService")
local inventory = script.Parent.Parent
function onClicked(GUI)
local openGoal = {}
openGoal.Position = UDim2.new(0.02, 0, .5, 0)
local closeGoal = {}
closeGoal.Position = UDim2.new(-0.17, 0, .5, 0)
local tweenInfo = TweenInfo.new(2)
local openInventory = TweenService:Create(inventory, tweenInfo, openGoal)
local closeInventory = TweenService:Create(inventory, tweenInfo, closeGoal)
local curr_pos = inventory.Position
if curr_pos.X.Scale <= -.169 then
openInventory:Play()
else if curr_pos.X.Scale >= 0.019 then
closeInventory:Play()
end
end
end
script.Parent.MouseButton1Click:connect(onClicked)

2 comments
So should I not use the Position property at all? Merely tween the anchor point?
the anchor point is just so it's on the exact position for every single device. you have to use position.