Humanoid jump on client

So i was trying to make a local script which would make the character jump on left click using context action service.

i set it up to use Humanoid.Jump = true, but when i came to running it, it didn’t work, and there were no errors. Then i set it up the same way again but using a remote event to request the server to set the jump to true, and it worked that way. Then when i opened the dev hub, it stated that humanoid.jump was not replicated across the client server boundary.

I need the character to jump instantly on click, and for there to be no lag, so is there any other method to make the character jump locally?

1 Like

Show the script to us. And you can try to use UserInputService

Why do you want it to jump “locally”?

--Local Script
local contextActionService = game:GetService("ContextActionService")
local replicatedStorage = game:GetService("ReplicatedStorage")

local player = game.Players.LocalPlayer
local char = player.Character

contextActionService:BindAction("JumpClick", function(actionName, inputState, inputObject)
    if inputState == Enum.UserInputState.Begin then
        player.Character:FindFirstChildOfClass("Humanoid").Jump = true
        replicatedStorage.Remotes.JumpCick:FireServer()
    end
end, false, Enum.UserInputType.MouseButton1)```

--ServerScript
local replicatedStorage = game:GetService("ReplicatedStorage")
replicatedStorage.Remotes.JumpClick.OnServerEvent:Connect(function(plr)
	plr.Character:FindFirstChildOfClass("Humanoid").Jump = true
end)

Like i said, i need it to be instant and unaffected by lag

Hello!
Instead of:

Humanoid.Jump = true

Can you try using:

Humanoid:ChangeState(Enum.HumanoidStateType.Jumping)

Doing it on the server would cause delay.

4 Likes

Setting the Jump property and changing the state do the exact same thing, there’s no difference.

Thank you, this method is working, but sadly if i spam click the humanoid will simply keep flying.

Is there a method with a built-in debounce?

Create some sort of cooldown for the button.

1 Like

As far as my knowledge goes, I don’t think so.

You might have to make a debounce for yourself.

setting the humanoid jump to true didnt seem to work for him, But my alternative does.
Plus I’ve also read reports about setting it to true client-sided didn’t seem to work (I am not sure of this though)

edit: if my method works for you, maybe mark my method as your solution unless you still need help yes?

The documentation says nothing about it checking to see if the humanoid is already in the air. Therefore, there is no difference.

Can you explain why setting Humanoid.Jump to true didn’t seem to work for him but why did Humanoid:ChangeState(Enum.HumanoidStateType.Jumping) seem to work?

It didn’t work because the Jump property isn’t replicated, the reason why your solution worked was because you force the Humanoid to jump.

1 Like

But Humanoid.Jump is forcing the humanoid to jump too isn’t it?