I have been trying to make my game mobile suppeoted by making the player jump high as pc players. It works on pc when i emulate my device on ipad, but then when i got to my mobile device the buttons dont work as a "nil" error

local contextActionService = game:GetService("ContextActionService")
local player = game.Players.LocalPlayer
local char = player.Character

function JumpHigh()
    char.Humanoid.JumpPower = 100
    char.Humanoid.Jump = true
    char.Humanoid.JumpPower = 50--I dont know why this doesnt work on mobile but works on pc
end

contextActionService:BindAction("jump", JumpHigh, true, "j")--Mobile bindaction
contextActionService:SetTitle("jump", "Super Jump")--the title of the button

2 comments

1

have you considered that humanoid may not exist in certain times. Also I would use Enum.KeyCode.J instead of "j"

0

Oh i see, thnx