Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Help with ContextActionService BindAction?

Asked by
Dorx86 0
7 years ago

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

1
have you considered that humanoid may not exist in certain times. Also I would use Enum.KeyCode.J instead of "j" Angels_Develop 52 — 7y
0
Oh i see, thnx Dorx86 0 — 7y

Answer this question