How to make a trampoline more efficient?

Hello, on my new game we have a trampoline on the main map to keep people entertained. The problem is, 40% of the time the trampoline doesn’t actually make you jump.

Here is a screenshot of the issue:

We don’t exactly know what to do in order to fix this issue.
Here is our current code for the trampoline:

local toggle = false --keep at false
local config = script.Parent:FindFirstChild("Configure") --finds Configure
local thrustlife = config:FindFirstChild("ThrustLifeTime").Value --Finds thrust life time

script.Parent.Touched:connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") then
        if not toggle then
            toggle = true 
            local thrust = Instance.new("BodyThrust")
            thrust.Force = Vector3.new(0,100,0) --PushForce
            hit.Parent:FindFirstChild("Humanoid").JumpPower = config:FindFirstChild("JumpHeight").Value
            hit.Parent:FindFirstChild("Humanoid").Jump = true
            game.Debris:AddItem(thrust, thrustlife) --Push force life time
            wait(2)
            hit.Parent:FindFirstChild("Humanoid").JumpPower = 0 --dont touch
            hit.Parent:FindFirstChild("Humanoid").Jump = false
            toggle = false
        end
    end
end)  

Thank you

3 Likes

Hey Fxuzy!

Does it really need such a complicated script to make a trampoline? I’m not very advanced at scripting.
I think this piece of code will do.

-- Trampoline

local function doJump(hit)
    local humanoid = hit.Parent:FindFirstChild("Humanoid")
    if humanoid then
	    humanoid.JumpPower = 100 -- Jump Height
	    humanoid.Jump = true
	    wait(2)
	    humanoid.JumpPower = 50 -- Normal Jump Height
    end
end

script.Parent.Touched:Connect(doJump)               

Greetings

:crown: Nova_MrRoyal :crown:

16 Likes

I agree with Nova. It dont need too much script to make a functional trampoline, you are just making things harder. Also you should use region3 or get touching parts because are more accurate. I think the touched event in your script is the problem.