Answered by
5 years ago Edited 5 years ago
Instead of using mouse.KeyDown, use ContextActionService:BindAction() with Enum.PlayerActions.CharacterJump.
01 | local CAS = game:GetService( "ContextActionService" ) |
03 | CAS:BindAction( "WallJump" , function (name, state, input) |
04 | if Humanoid:GetState() = = Enum.HumanoidStateType.Freefall and Db then |
06 | local ray = Ray.new(Root.Position, Root.CFrame.lookVector* 2.5 ) |
07 | local hit = game.Workspace:FindPartOnRay(ray, Character) |
10 | if hit:IsA( "BasePart" ) and hit.CanCollide = = true then |
17 | if (hit.Position.Y + (hit.Size.Y / 2 )) - Root.Position.Y < = 10 then |
18 | wallJumpTopAnimTrack:Play() |
19 | Character.Humanoid.AutoRotate = false |
24 | Character.Humanoid.AutoRotate = true |
25 | Root.Velocity = Vector 3. new( 0 , 75 , 0 ) |
29 | if LatestPart ~ = hit then |
30 | wallJumpAnimTrack:Play() |
31 | Character.Humanoid.AutoRotate = true |
34 | script.Remotes.Walljump:FireServer() |
37 | Character.Humanoid.AutoRotate = true |
38 | Root.Velocity = Root.CFrame.lookVector * - 57 + Vector 3. new( 0 , 113 , 0 ) |
44 | if Humanoid.Health < 35 then return end |
45 | if not CanDouble then return end |
46 | if not doublecd then return end |
53 | Root.Velocity = Vector 3. new( 0 , 65 , 0 ) |
54 | doubleJumpAnimTrack:Play() |
57 | doubleJumpAnimTrack.Stopped:Wait() |
67 | return Enum.ContextActionResult.Pass |
68 | end , false , Enum.PlayerActions.CharacterJump) |
This should handle all methods of jumping on all platforms.
Edit: Replace the UIS.InputBegan handler with this