My trampolines are just anchored block parts, to which I give a script
trampoline.Velocity = Vector3.new(0, bounce, 0)
They work, but in mysterious ways. Even tho the bounce value doesn’t change, they make the player jump different heights each time player touches them. I understand that this is because of how physics work, but I dont undertsand How to make them make player jump the same height each time?
local Force = 1e3
hit.Parent.HumanoidRootPart:ApplyImpulse(Vector3.new(0, Force, 0))
Also I found that your script doesnt have a debounce, here is a fix:
For the debounce to work properly make sure that the script is a local script, there will be no difference, except for maybe speed improvements.
local trampoline = script.Parent
local Force = 1e3 -- 1 followed by 3 zero's
local Debounce = false
trampoline.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") and game.Players:GetPlayerFromCharacter(hit.Parent) == game.Players.LocalPlayer then
if Debounce then
return
end
Debounce = true
hit.Parent.HumanoidRootPart:ApplyImpulse(Vector3.new(0, Force, 0))
task.wait(0.2) -- nice to see someone using task.wait() instead of the deprecated wait()
Debounce = false
end
end)
Try that and tell me if it works, if it does, mark my post as a solution!
Adding a folder with that configuration is absolutely unnecessary. Also the surfacegui part without any actual surface gui hints that you pretty much copied a script from toolbox. Also you did the same thing I said I already tried. Thank you.
You could put it somewhere where it would run and change the variables or if that is not an option, something like this should work:
local trampoline = script.Parent
local Force = 1e3 -- 1 followed by 3 zero's
local Debounces = {}
trampoline.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
if Debounces[hit.Parent] then
return
end
Debounces[hit.Parent] = true
hit.Parent.HumanoidRootPart:ApplyImpulse(Vector3.new(0, Force, 0))
task.wait(0.2) -- nice to see someone using task.wait() instead of the deprecated wait()
Debounces[hit.Parent] = false
end
end)