You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve? Keep it simple and clear!
Im trying to make a gui that is draggable ( without using the depracated draggable property )
- What is the issue? Include enough details if possible!
How would i make the gui position non relative to ancestors position
- What solutions have you thought of so far?
My code
uis.InputBegan:Connect(function(input, gpe)
if not gpe and input.UserInputType == Enum.UserInputType.MouseButton1 then
local pos = uis:GetMouseLocation()
local guis = plr:WaitForChild("PlayerGui"):GetGuiObjectsAtPosition(pos.X, pos.Y)
local highest = -math.huge;
local highestGUI;
local highestPos;
for _, v in next, guis do
if v.ZIndex > highest then
highest = v.ZIndex
highestGUI = v
highestPos = v.Position + v.Size
end
end
repeat
local pos = uis:GetMouseLocation()
highestGUI.Position = UDim2.new(0, pos.X, 0, pos.Y)
game:GetService("RunService").RenderStepped:Wait()
until not uis:IsMouseButtonPressed(Enum.UserInputType.MouseButton1)
end
end)