Hi, I am trying to make some controls for a rocket that requires 2 JoySticks 1 for steerig and another for throttle, I tried using TouchPan cause when I was using the UserInputService.TouchMoved it trigger the TouchedEnded when I let go of one of the joySticks and that made it stop working this is the code am using to make my imageLabel behave like a JoyStick but it`s not working correctly. Cause it moves it way out of the Frame
local function onThrottleTouchPan(touchPositions, totalTranslation, velocity, state)
if state == Enum.UserInputState.Begin and not throttleDragging then
print("Input Began")
throttleDragging = true
Throttle_Frame.BackgroundTransparency = 0.8
--Throttle_Button.Visble = true
elseif state == Enum.UserInputState.Change then
local pos = touchPositions[1]
print(pos)
if (pos.X > Throttle_GuiPos.X) and (pos.X < Throttle_GuiPos.X + Throttle_GuiSize.X) and (pos.Y > Throttle_GuiPos.Y) and (pos.Y < Throttle_GuiPos.Y + Throttle_GuiSize.Y) then
local startPos = Throttle_Button.Position
local position = UDim2.new(startPos.X.Scale, startPos.X.Offset, startPos.Y.Scale, startPos.Y.Offset + totalTranslation.Y)
Throttle_Button.Position = position
print("Pos", position)
end
--tweenButton(Throttle_Button, position, dragSpeed)
print(touchPositions)
print(totalTranslation)
print(velocity)
elseif state == Enum.UserInputState.End and throttleDragging then
print("input ended")
tweenButton(Throttle_Button, THROTTLE_ORIGINAL_POS, dragReturnSpeed)
RocketControl:FireServer("SpeedUp", false)
RocketControl:FireServer("SlowDown", false)
throttleDragging = false
Throttle_Frame.BackgroundTransparency = 1
end
end