Cross platform aircraft script not working

I have this code for a plane script on mobile that hasn’t been working right. The plane on mobile won’t respond to the user’s direction change commands via their movement on the touch screen.

I’m trying to get the plane to move based on the touch location of the mobile user (i.e. where they tap/drag/whatever), such as if the player is dragging/touching right, it’ll bank/move right, same for up, down, left, etc. This script does not respond to any of the mobile user’s touch commands, and I have no idea why. It has a similar issue for console as well.

Basically, I need to find and detect the mobile (and console) equivalent of mouse.Hit, mouse.ViewSizeX, and mouse.X on PC. The script works fine on desktop/PC, and I attribute the issue to the mouse properties I’m attempting to use, but I don’t know much about how to manipulate any input properties besides desktop.
I’m pretty new to working with mobile commands, so I’m not even sure what I have is the right approach.

Here’s my script:

---Client sided code; this is in one script
local dY --- different approach I tried
local dX
local lastTouchTranslation = nil
local function setup_Touch(touchPositions, totalTranslation, velocity, state)
    local difference
    if state == Enum.UserInputState.Change or state == Enum.UserInputState.End then
        difference = totalTranslation - lastTouchTranslation
    end
    lastTouchTranslation = totalTranslation
    print(difference.X)
    print(difference.Y) ---print statements won't work
    dX = difference.X
    dY = difference.Y
    return difference.X, difference.Y ---I tried to get the code to work via a return of this function originally, to no avail, so I tried a different method with the dX and dY functions.
end

----below function detects mobile movement. Not sure if this is the right one to use.
UserInputService.TouchPan:Connect(function() rem.onMouseMoved:FireServer(mouse.Hit,setup_Touch) end) --- this code is in a bigger function group that detects input on different devices

---Server sided code; code works on PC perfectly with mouse input, doesn't work so much with mobile and console input. In separate script from client code.

function GetBankAngle(M,ViewSizeX,X) ---- this manages the banking features of plane, makes movement look less clunky.
    local VSX,X = ViewSizeX,X
    local Ratio = (((VSX / 2) - X)/(VSX / 2))
    Ratio = (Ratio < -1 and -1 or Ratio > 1 and 1 or Ratio)
    return math.rad(Ratio * 90)
end

function onMouseMoved(mouse,ViewSizeX,X) --- changes direction of aircraft via player moving their cursor.
    local BankAngle = GetBankAngle(mouse,ViewSizeX,X) 
    if fly == true then
        turn = true
        while turn == true do
            if heli ~= nil then
                if heli.Parts:FindFirstChild("Engine") ~= nil then
                    heli.Parts.Engine.BodyGyro.cframe = (mouse * CFrame.Angles(0,0,BankAngle))
                    --Direction.cframe = (mouse.Hit * CFrame.Angles(0,0,BankAngle))
                    --heli.Parts.Engine.BodyGyro.cframe = mouse.Hit
                end
            end
            wait(0.1)
        end
    end
end
local rem=script.Parent.Remotes 
rem.onMouseMoved.OnServerEvent:connect(function(player,hit,ViewSizeX,X)
    onMouseMoved(hit,ViewSizeX,X)
end)

---the output I am given says that they cannot perform arithmetic on nil values, that being the ViewSizeX and X values.

Considering the complexity of the question, it might be easier if you provide a place file with the model so we can test it ourselves.

Have you tried it in Studio choosing a mobile device and running in single user mode?

plane.rbxl (56.4 KB)

Here is a file with the plane (and necessary systems for remotes and what not)

@RamJoT
I have tested it via online mode, not by testing in studio. I have a script/GUI that tells output so I used that to see what was going on in online mode.

Ok, tks for file.
First run I get error in Color script line 5.
When referring to object further up the hierarchy I always step up rather than trying to work out how many Parent steps to take.
In this case the number of steps must be incorrect as there is no team object anywhere in the hierarchy above the script.
Using Find through the scripts I had no hits on this name.
Also get
Error checking in group: Player:GetRankInGroup failed because HTTP 400 (Bad Request)
I am guessing I am not in the group anyway but not sure why I get 400