How to remove this delay on my jumppad?

Hello, I do not have much knowlege with scripting but have this I did this jumppad.
The jumppad has a delay on jumping tho and I tried much to fix it but nothing worked so does anyone here know why there is a delay and how to fix it?

image

pad = script.Parent

function jump(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		local humanoid = hit.Parent:FindFirstChild("Humanoid")
		humanoid.JumpHeight = 25
		humanoid.Jump = true
		wait(.5)
		humanoid.JumpHeight = 7.2
	end
end

pad.Touched:Connect(jump)
1 Like

Touched has always had a small delay, the way to get around that is people usually use raycast or magnitude. That being said your script would probably work a lot better if it was cleaned up a bit.

script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild('Humanoid') then
		local hum = hit.Parent.Humanoid
		hum.JumpHeight = 25
		hum.Jump = true
		wait(.5)
		hum.JumpHeight = 7.2
	end
end)

Try this out.

I tested that script out. It has less delay than before but it still has delays sometimes and sometimes not. Thank you tho.

I had the same problem in my chart. I solved it by putting an invisible part above the jumppad, which triggers the touched event sooner.

1 Like

Oh yeah that works better. Thank you very much