I am making a game and I am struggling to make a script that when you jump onto a part it bounces you and the higher you jump the higher you bounce. How would I do this?
1 Like
You could set the JumpHeight of the player humanoid depending on the time between the jump start and the touch event of the jump part, and then just change the state of the humanoid to jumping or set the jump property to true.
3 Likes
This’ll probably help you…
local part = game.Workspace.Part
local bounceForce = 2000
function onPartTouched(otherPart)
if otherPart.Parent:FindFirstChild("Humanoid") then
local jumpHeight = otherPart.Parent.Humanoid.JumpHeight
local totalForce = jumpHeight * bounceForce
otherPart.Parent.Humanoid.Jump = true
otherPart.Parent.Humanoid:ApplyImpulse(Vector3.new(0, totalForce, 0))
end
end
part.Touched:Connect(onPartTouched)
3 Likes
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.