Teleport button make character jump

Hello I am new to the DevForum and this is my first post.

  1. What do you want to achieve? I have a teleport button but I just need to know how to make it so if your in a vehicle seat or a seat then, you press the tp button and your character will auto jump to prevent this.

  2. What is the issue?


  3. What solutions have you tried so far? I’m only a beginners script so I only know a little bit of scripting.

here’s the code for the TP button

character = game.Players.LocalPlayer.Character
script.Parent.MouseButton1Click:connect(function()
character.HumanoidRootPart.CFrame = CFrame.new(workspace.TP_Point.Position)
script.Parent.Parent.Parent.Parent.Teleport_Areas.Visible = false
end)
–don’t worry about the TP_Point, that is my brick name where players teleport

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

Use

character:WaitForChild("Humanoid").Jump = true

Whenever you run this line of code, the player should jump.

Uh nope my character doesn’t jump when in the vehicle seat it still TP inside of it.

So you want the player to jump out of the seat if they are seated, before they are teleported so they don’t take the vehicle with them?
Your explanation doesn’t say anything about that, and your pictures show you seated in a vehicle so I am just assuming this is what you are trying to prevent.

ya that is what I’m trying to do is to prevent players from taking the vehicles with them while seated when they press the TP button.

Did you put @IndexSource’s code ahead right after your Mousebutton1Click line?

You could also check to see if the player is seated first, and only jump them if they are seated.

yes I did put his code right after that but didn’t seem to work

That code will cause your player to jump. It should do exactly what you want, what exactly is happening when you run it?

Please copy your new code here, but put 3 asterisks before and after the code so it copies the format as well. (***)
code

script.Parent.MouseButton1Click:connect(function()
character:WaitForChild("Humanoid").Jump = true
character.HumanoidRootPart.CFrame = CFrame.new(workspace.TP_Point.Position)
end)```

It’s not actually 3 asterisks, format it like this.

```(your code)```

but leave out the parenthesis.

It’s tough to give an example, but put the three asterisks right before as well as right after your code.

Thanks @itsokayepic. My bad.

So what exactly is happening when you run it? I’m sort of confused, it should do what you ask.

ya I don’t know why it doesn’t work unless you have to type the code in a different way but I don’t know

character.Humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
3 Likes

oh it works thanks :slight_smile:

You can use character.Huamanoid.Jump = true to make the character jump at least once

I try it and it doesn’t work but someone helped me out on it thanks to @vsefu1 for the code