if hit.Parent:FindFirstChild("Humanoid") then
local humanoid = hit.Parent:FindFirstChild("Humanoid")
humanoid.JumpHeight = 75
humanoid.Jump = true
animateBounce() -- Animates a bouncy mushroom to do a bounce animation
wait(0.25)
humanoid.JumpHeight = 7.2
end
end
pad.Touched:Connect(jump)```
I need some help with this code. I'm trying to make a bounce pad, and it works for the most part. My only problem is that if the player tries to jump ONTO the bounce pad, the bounce pad waits until the player hits the ground before applying the "jump = true"
#Issue With Bounce Pad Script
1 messages · Page 1 of 1 (latest)
that's because of how .Touched operates
Okay, but is there a way to make it work instantly?
there're a few, but I'm guessing they'd all be a little more expensive
you could use RunService with :GetTouchingParts()
Okay, what else is there?
you could probably mathematically split up the surface area into points and raycast a unit or 2 up
** You are now Level 4! **
you don't have to use runservice necessarily, but you'd need to constantly be running a few lines of code at satisfactory rate to get the bounce effect
what would that look like
im REALLY new to coding so im quite lost
a while loop probably
I dont know how to create a while loop that checks the touch condition between a player and an object
** You are now Level 1! **
while true do
local touchingParts = workspace:GetPartsInPart(pad)
for _, part in ipairs(touchingParts) do
local humanoid = part.Parent:FindFirstChild("Humanoid")
humanoid.JumpHeight = 75
humanoid.Jump = true
end
task.wait()
end
ill try it
I attempted to experiment with it in studio a little bit, touched and :gettouchingparts are essentially the same thing, so that's my bad
the only issue with what I wrote is the latency
so I don't think my method was very effective
it still has that annoying delay
can i see this in action
it seems more instant only because I put an invisible part at the bottom of the red part of the mushroom so it hits a solid surface faster
ill send one video without it
its easier to see the latency issue here
what does the collision box of the mushroom look like
none of it is collidable, but the red part of the mushroom has touching turned on to activate the event
the bounds of the collision check are exact
got it
you touch red = you jump
can you give me a code example?
local runService = game:getService("RunService")
runService.Heartbeat:connect(function()
--your jump shit here
end)
the game lags
** You are now Level 2! **
the game lags very hard
prob because the thing never gets disconnected
this is true
heres how to disconnect something
local runService = game:getService("RunService")
local runConnection
runConnection = runService.Heartbeat:connect(function()
if runConnection then
runConnection:Disconnect()
runConnection = nil
end
--your jump shit here
end)
i think something like that idk
@ebon swallow just use .touched on the client
what
Even if it’s “not safe”, that really doesn’t matter since exploiters can just run a script to fly or jump even higher
So in a client script, just loop through all the bounce pads, and use .touched on that invisible hitbox thing
This negates the latency since it’s on the client + it’s more accurate
i thought of this too but i didnt know if its legit
.touched is also a lot more optimized than running a heartbeat for every single jump pad
Especially if you’re using that many heartbeats on the server
It’s bound to cause a memory leak
yeah lol
or
or
if you wanted to be fucking different
use collection service
put all bounce pads in a folder
loop through the folder
apply just one script so all do the same thing
BAM
heartbeat and easy disconnect
That’s what I JUST said
Latency…
You get what I’m saying right @ebon swallow
ok
not really
yeah this is the code rn
I made it a child of the invisible part
you should be using bodyvelocity
you would think
thats a horrible way of doing it
** You are now Level 5! **
if you send me a body velocity script ill show you that it doesnt work
k
@ebon swallow
local Debris = game:GetService("Debris")
local Player = game.Players.LocalPlayer
local Character = Player.Character
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
local jumpPadsFolder = workspace:WaitForChild("JumpPads")
local settings = {
jumpForce = 80,
velocityLifeTime = .5
}
local Connections = {}
local function jump(object)
local bodyVelocity = Instance.new("BodyVelocity", HumanoidRootPart)
bodyVelocity.MaxForce = Vector3.yAxis * HumanoidRootPart.AssemblyMass^2 * workspace.Gravity
bodyVelocity.Velocity = Vector3.yAxis * (object:GetAttribute("JumpForce") or settings.jumpForce)
Debris:AddItem(bodyVelocity, (object:GetAttribute("VelocityLifeTime") or settings.velocityLifeTime))
end
local function registerJumpPad(object)
if object:FindFirstChild("Hitbox") then
Connections[object] = object.Hitbox.Touched:Connect(function(h)
if h:IsDescendantOf(Character) then
jump(object)
end
end)
end
end
local function removeJumpPad(object)
if Connections[object] then
Connections[object]:Disconnect()
Connections[object] = nil
end
end
for i, jumpPad in jumpPadsFolder:GetChildren() do
registerJumpPad(jumpPad)
end
jumpPadsFolder.ChildAdded:Connect(registerJumpPad)
jumpPadsFolder.ChildRemoving:Connect(removeJumpPad)
localscript in startercharacterscripts
it seems like I need something on top of that
what
what's a jumpPads folder?
you need to make one
make a folder in the uh
workspace
and name it jumpPads
yes
also change the name of hitbox
in the script
if the invisible part isnt named Hitbox
bro i really want the scripter role
but im WAYYYY too lazy to apply
dor s1 they will take a fucking simple tween door function
and a touched event
and say
yup
s1
the standards for s2 isnt exactly clear btw
idk why they gatekeep that
i dont even know the standards for anything
i dont even know what s1 or s2 is
or whatever this NONSENSE is
too lazy
yeah
but its cool if youre ever curious about what other people think
some dont really give good feedback though
how do I specify what the hitbox object is
ohhh ok
you gave him something he doesnt understand 💔
@ebon swallow id ask questions about how the script works so you know what youre using
i shouldve explained it actually
no im locked in
I think I got it working
its funny how that works out
he probably did
seeeee I know what im talking aboout
does sanches know what type annotation is 💔
yes
send me the children of the jump pad
its only one part
oh
i love you for that
local Debris = game:GetService("Debris")
local Player = game.Players.LocalPlayer
local Character = Player.Character
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
local jumpPadsFolder = workspace:WaitForChild("JumpPads")
local settings = {
jumpForce = 80,
velocityLifeTime = .5
}
local Connections = {}
local function jump(object)
local bodyVelocity = Instance.new("BodyVelocity", HumanoidRootPart)
bodyVelocity.MaxForce = Vector3.yAxis * HumanoidRootPart.AssemblyMass^2 * workspace.Gravity
bodyVelocity.Velocity = Vector3.yAxis * (object:GetAttribute("JumpForce") or settings.jumpForce)
Debris:AddItem(bodyVelocity, (object:GetAttribute("VelocityLifeTime") or settings.velocityLifeTime))
end
local function registerJumpPad(object)
if object.Name == "InvisPart" then
Connections[object] = object.Touched:Connect(function(h)
if h:IsDescendantOf(Character) then
jump(object)
end
end)
end
end
local function removeJumpPad(object)
if Connections[object] then
Connections[object]:Disconnect()
Connections[object] = nil
end
end
for i, jumpPad in jumpPadsFolder:GetChildren() do
registerJumpPad(jumpPad)
end
jumpPadsFolder.ChildAdded:Connect(registerJumpPad)
jumpPadsFolder.ChildRemoving:Connect(removeJumpPad)
sanchez locked in
is this over engineered or 💔
thats bare minimum buddy
i mean yea
so... its smooth, but I still hit the ground
but to me its just a jump pad
can we give it a little more oomph somehow
overengineering it would be using OOP and custom jumppad classes
jump 100^100
or if thats not enough
i made it so that
you can add attributes
to the jumppad
tbh that would just be cleaner
what does velocitylifetime change
yeah
so more force less lifetime?
** You are now Level 3! **
i can make it just adjusting the height
instead
and calculate the velocity
from that
let him figure it out 😭
you can make the ideas so just explain it in those small pieces
s=d/t
mhm
I know some of these words
sanches
whoops
sanchez
bro
change the velocity based on s/dt
fuck
s=d/t*
my bad
absolutely not
real
ive wasted half my lifespan on roblox
fuck
roblox is cheeks
i know python though
ive been wanting to use godot
and html js and whatnot
python similar to gdscript 🤑
i mean lowkey yeah
cant complain though
roblox does a lot of the heavylifting and hand holding for you
@rose patio is there a way I can make a velocity barrier before the ground that prevents the player from going too far down
what
like, the closer the player gets to the floor, the more velocity is applied to the player or something
so if the player is just before the floor, they get infinity velocity applied or something so they dont hit the ground
I just really dont want the player hitting the floor
does that make any sense
nope
this is the important part
maybe like
@rose patio is it possible
if y velocity is at a certain point
make the other time higher
to compenstate for how fast theplayer is going
actually scrap that
dont listen to that
is there a way to cancel velocity
uhh yes i guess
yea
im so confused
I want to cancel the players velocity when they first touch the invisible part
that way its impossible to hit the ground
this to me makes no sense
its just so they stop falling before they get pushed up
I dont want them to hit the ground
that has to make sense
oh
heh yeah bub i got a solution
add to the jump function
HumanoidRootPart.AssemblyLinearVelocity = Vector3.zero
nevermind its the most dumbest shit
yeah this is way smarter
okay well it doesnt FULLY work
we forgot about the animation
what was the point of me writing allat then 💔
I can just take the jump part out of the old script
or
you can just
transfer the animation part
into the client
becasue thats better
but why wouldnt I want the bounces to be visible to everyone
animations are one of the only things that roblox lets the client show the server
like
the default roblox animate script
is all client sided
as an example
@rose patio @sterile thicket good news the animation and jumping work perfectly
w
I also added a boioioioing sound effect
** You are now Level 4! **