Help with creating a smooth jump plate

Hey there! So recently, I’ve been studying body velocity and stuff and I am trying to make somthing like this:

I am trying to figure out how I can make such a smooth jump like that. I have looked all over the forum and read up on body velocity and body movers, but I am still not exactly sure how I would do this. I tried to implement one of my old weapon trajectory scripts to see if it would work with the player, but it didn’t launch me at all(not surprised lol)

Here is the script I tried:

local debounce  = false

script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		if debounce == false then
			debounce = true
			local char = hit.Parent
			local hrp = char:FindFirstChild("HumanoidRootPart")
			local target = script.Parent.Parent.End
			hrp.Velocity = ((hrp.Position - target.Position).unit * -script.Parent.Parent.Value.Value + Vector3.new(0,50,0))
			print("launched")
			wait(2)
			debounce = false
		end
	end
end)

There are no errors, it just doesn’t work. I think velocity is deprecated as well.

Any help would be great :slight_smile:

1 Like

That script doesn’t launch you at all or does it not launch you smoothly?

Doesn’t launch at all lol

30char

First of all, there are a number of ways to add velocity to a part (and your character). You can use the body movers (BodyForce or BodyVelocity or BodyPosition). The velocity definitely works too.

In your example, maybe the velocity is too small? Or maybe it’s in the wrong direction (downwards instead of upwards). Try to print the velocity before you assign it and see what happens there?

local vel = ((hrp.Position - target.Position).unit * -script.Parent.Parent.Value.Value + Vector3.new(0,50,0))
print(vel)
hrp.Velocity = vel

What does that print?

-49.919094085693, 48.110740661621, 2.1247146129608

The problem is, the character doesn’t even move.

I think I am using the script wrong :confused:

There are some other things to note here as well. When running normally humanoids apply all sorts of forces on their own based on their ‘actions’, and if you want smooth physics and forces that are applied properly on your character you might want to look into this:

For example enabling PlatformStand during the Velocity application might help. Not entirely sure though :stuck_out_tongue:

1 Like

Ok 3 things you can try:

  1. Do what @Daronion says. Basically change the humanoid state before applying velocity like so
local hum = char:FindFirstChild("Humanoid")
hum:ChangeState(Enum.HumanoidStateType.Physics)
  1. Multiply that velocity with a big number (ex: 100) to see if higher velocity works.
  2. Try to use BodyForce.
1 Like
  1. I tried sending a remote event to the player to change the state, however it didn’t do anything.

  2. I have multiplied the velocity by a big number, it is the script.Parent.Parent.Value.Value

  3. Do you have any examples of how i could do it?

Wait what? You don’t need to send any remoteEvent.

local debounce  = false

script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		if debounce == false then
			debounce = true
			local char = hit.Parent
			local hrp = char:FindFirstChild("HumanoidRootPart")
			local target = script.Parent.Parent.End
			local vel = ((hrp.Position - target.Position).unit * -script.Parent.Parent.Value.Value + Vector3.new(0,50,0))
            print(vel)
            local hum = char:FindFirstChild("Humanoid")
            hum:ChangeState(Enum.HumanoidStateType.Physics)
            hrp.Velocity = vel
			print("launched")
			wait(2)
			debounce = false
		end
	end
end)
1 Like

I’ve noticed that you are using velocity, which will not work in the current day as it is not supported anymore. I suggest using body movers. (like what others are suggesting)

You can replace

with

local BV = Instance.new("BodyVelocity",hrp)
BV.Velocity = ((hrp.Position - target.Position).unit * -script.Parent.Parent.Value.Value + Vector3.new(0,50,0))
print("Launched")
wait(2) -- adjust accordingly
BV:Destroy()

Hopes this helps!

More on body velocity: BodyVelocity | Roblox Creator Documentation

Sorry I read that in the platformstand state, that it can only be changed in the local script.

Thanks! This works.

Idk who I should make as solution. Who wants it :slight_smile:

2 Likes

Sorry, one more thing, it sends it shooting in the air, however, when the body force is destroyed, the player will immediately come down.

I tried making it longer, but it just keeps on going upwards.

How can I made it have a smooth landing too?

The BodyVelocity @Lucarkirb mentioned is basically trying to maintain a given Velocity, therefore you should only keep it alive for about 1 second, and afterwards destroy it. However, even after you destroy it, coming back to my previous comment:

Your humanoid is probably in a state that doesn’t allow for smooth physics conservation, so the velocity that the BodyVelocity applied is instantly interrupted.

Based on my understanding, you are running this in a Server script, right? What would be the problem if you did this in a local Script? I recommend moving your code into a new Local Script under CharacterScripts: StarterCharacterScripts | Roblox Creator Documentation

Careful though as you won’t be able to use: script.parent.Touched , you will need to reference the part within your workspace. So if the name of the part is ‘GivenPart’, you should change your script to:

local debounce  = false
game.Workspace.GivenPart.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") and hit.Parent.Name == game.Players.LocalPlayer.Name then
		if debounce == false then
			debounce = true
			local char = hit.Parent
			local hrp = char:FindFirstChild("HumanoidRootPart")
			local target = script.Parent.Parent.End
			local vel = ((hrp.Position - target.Position).unit * -script.Parent.Parent.Value.Value + Vector3.new(0,50,0))
            print(vel)
            local hum = char:FindFirstChild("Humanoid")
            hum:ChangeState(Enum.HumanoidStateType.PlatformStanding)
            local BV = Instance.new("BodyVelocity",hrp)
            BV.Velocity = vel
            print("Launched")
            wait(0.5) -- adjust accordingly
            BV:Destroy()
            debounce = false
		end
	end
end)

PS. I am unfortunately unable to use Roblox Studio atm, therefore I might have made some mistakes, please let me know if there are any errors :slight_smile:

2 Likes