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!
An draggable gui (Already did that) that only drags one gui and not bring along the frames under it. -
What is the issue? Include screenshots / videos if possible!
When you drag the gui, if there is any other gui under the target, it will be dragged as well as long as it is under the mouse.
EXAMPLE:
Settings tab, ready to be dragged. (With app store under the cursor.)
After being dragged, the app store comes along as well.
Keep in mind this only happens when the cursor is on top of both frames.
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
trouble shooting
Local script inside the frame, this script is only slightly altered for each draggable frame.
local UIS = game:GetService('UserInputService')
local frame = script.Parent
local dragToggle = nil
local dragSpeed = 0.25
local dragStart = nil
local startPos = nil
local Sframe = script.Parent
local Aframe = Sframe.Parent.AppStoreTab
local function updateInput(input)
local delta = input.Position - dragStart
local position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X,
startPos.Y.Scale, startPos.Y.Offset + delta.Y)
game:GetService('TweenService'):Create(frame, TweenInfo.new(dragSpeed), {Position = position}):Play()
end
frame.InputBegan:Connect(function(input)
if (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then
dragToggle = true
dragStart = input.Position
startPos = frame.Position
input.Changed:Connect(function()
if input.UserInputState == Enum.UserInputState.End then
dragToggle = false
end
end)
end
end)
UIS.InputChanged:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
if dragToggle then
updateInput(input)
end
end
end)
frame:GetPropertyChangedSignal("Position"):Connect(function()
Sframe.ZIndex = 20
Aframe.ZIndex = 10
end)
frame:GetPropertyChangedSignal("Visible"):Connect(function()
if not frame.Visible then
game:GetService('TweenService'):Create(frame, TweenInfo.new(dragSpeed), {Position = UDim2.new(0.048,0,0.142,0)}):Play() --position it returns to.
end
end)