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

Help with StarterCharacter Jump Using InputService?

Asked by 5 years ago

I have a game with a StarterCharacter that does not work with the regular roblox jump. I ended up using bodythrust with a script that detects when the player hits w. Nothing happens on mobile and controller however. I can't find how to add a inputservice for the mobile jump button or whatever the jump button is on controller. Is this the easiest way to do this or is there a better way? All help is appreciated thank you!

Copy of the code I am currently using.

local plr = game.Players.LocalPlayer repeat wait() until plr.Character local char = plr.Character local human = char:WaitForChild("Humanoid") local inputservice = game:GetService("UserInputService")

human.Changed:connect(function() human.Jump = false end)

inputservice.InputBegan:connect(function(inputobject) if inputobject.KeyCode == Enum.KeyCode.Space then char.Head.JumpThrust.Force = Vector3.new(0,1100,0)

    wait(.25)
    char.Head.JumpThrust.Force = Vector3.new(0,-1250,0)

    wait(.3)
    char.Head.JumpThrust.Force = Vector3.new(0,0,0)
 end

end)

0
Sorry code did not go in there right. New to this. TJim_YT 0 — 5y

Answer this question