That’s problematic. I think the root issue is that causing a jump as a side-effect of setting Humanoid.Jump is a design flaw. Instead, there should be a function, Humanoid:Jump().
I wonder if it is done the way it is to make it easier to cancel jumping in some games?
I actually disagree. In my obby game i made a year or two ago, I have a jump pad that looks like this:
local deb = false
script.Parent.Touched:connect(function(p)
if deb == false then
if p.Parent:FindFirstChild("Humanoid") then
deb = true
p.Parent.Humanoid.JumpPower = 200
p.Parent.Humanoid.Jump = true
print("jumped")
wait(1)
p.Parent.Humanoid.JumpPower = 50
end
end
end)
Surprisingly, jumped only prints once, and your character also jumps really high.
I’m pretty confused as why it doesn’t work in your situation.
After downloading your place file, I can approve that it doesn’t work 100% of the time, but sometimes the character also jumps without uncommenting the for loop.
It could be that the problem has been partly solved, but i’m not 100% sure.
My specific method is to actually do this on the clientside – Remember, player physics is handled on the client, so making players jump or move in any manner on the clientside is a valid action and is arguably preferred since it ensures zero-latency feedback for given actions.
In my own game I have a double-jump script that simply just sets the humanoid state to jumping (doesn’t set Jump = true, it calls ChangeState instead) and it works 100% of the time without error. That, and it’s super short:
local humanoid = character.Humanoid
local oldJumpPower = humanoid.JumpPower
humanoid.JumpPower = 100
humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
humanoid.JumpPower = oldJumpPower
No waits necessary since this is all on the client so latency is not a problem. Works great. You may consider trying to reference the jump pad from the client and connect Touched there.
Yeah one of the most frustrating things about debugging this issue was that I had other jump pads I loaded from free models and those all worked with Humanoid.Jump = true.
I spent an hour cutting and pasting code into my code trying to do a binary search through the problem space.
Then it turned out I had a write-write conflict with some hidden core script.
I did try this. Doesn’t work reliably in my case. It probably sets Humanoid.Jump = true behind the scenes.
Maybe the issue is that I am setting Humanoid.Jump = true from a server-side script.
If setting this server-side is problematic, it would be cool if I got some feedback about that. For instance, this property could be read-only server side.