Problem With 2D Movement Script

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    Im trying to make 2d movement scipt
  2. What is the issue? Include screenshots / videos if possible!
    the issue is it doesnt work on mobile everything works great on pc but on mobile it doesnt work as the context action buttons doesnt change position accordingly
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    i found no solution :frowning_face:
    After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
local player = game.Players.LocalPlayer
local RunService = game:GetService('RunService')
local ContextActionService = game:GetService('ContextActionService')
 
local jumping = false
local leftValue, rightValue = 0, 0 

local function onLeft(actionName, inputState)
	if inputState == Enum.UserInputState.Begin then
		leftValue = 1
	elseif inputState == Enum.UserInputState.End then
		leftValue = 0
	end
end
 
local function onRight(actionName, inputState)
	if inputState == Enum.UserInputState.Begin then
		rightValue = 1	
	elseif inputState == Enum.UserInputState.End then		
	rightValue = 0	
	end
end
 
local function onJump(actionName, inputState)
	if inputState == Enum.UserInputState.Begin then		
		jumping = true	
	elseif inputState == Enum.UserInputState.End then		
		jumping = false	
	end
end
 
local function onUpdate()
	if player.Character and player.Character:FindFirstChild('Humanoid') then		
		if jumping then			
			player.Character.Humanoid.Jump = true		
		end		
		local moveDirection = rightValue - leftValue		
		player.Character.Humanoid:Move(Vector3.new(moveDirection,0,0), false)
	end
end
 
RunService:BindToRenderStep('Control', Enum.RenderPriority.Input.Value, onUpdate)
 
ContextActionService:BindAction('Left', onLeft, true, 'w', Enum.KeyCode.Up, Enum.KeyCode.DPadUp)
ContextActionService:BindAction('Right', onRight, true, 's', Enum.KeyCode.Down, Enum.KeyCode.DPadDown)
ContextActionService:BindAction('Jump', onJump, true, 'space', Enum.KeyCode.Space, Enum.KeyCode.ButtonA)
ContextActionService:SetPosition('Left', UDim2.new(0, 180, 0, 160))
ContextActionService:SetPosition('Right', UDim2.new(0, 180, 0, 160))
ContextActionService:SetPosition('Jump', UDim2.new(0, 105, 0, 70))

here is my current local script inside StarterPlayerScripts
Any help is appreciated.Thanks for reading!

Anybody help?? :worried: :weary: :tired_face:

Did you make anything on mobile? It seems as if you’re asking for a script.

i mean that the contextactionservice :SetPosition doesnt work