Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Have the player jump towards position?

This is another part for my survival game! I've figured out what I've needed, the player holding the curtains, and detecting if they're facing at it or not! The only thing left to do is when they press the Spacebar, the player jumps towards the position they're facing at. I have a bit of code for this such as

if mouse.Target == game.Workspace.facingright then
      UIS.InputBegan:Connect(function(input, gameProcessedEvent)
             if input.KeyCode == Enum.Keycode.Space then
                     --jump code would go here.
              end
      end)
end

As I don't know how to start where the player jumps towards the position. I've made many attempts for this such as having the player's camera be stationary, but still able to be rotated, (like first person.) I've disabled the player jumping manually, as the script makes them get closer to the position they're facing. But I still can't seem to figure this out.

Can anyone help me on this? Thanks! Any working answer is appreciated, thanks!

2 answers

✓ Accepted answer

What I would do is tween the seat.

Humanoid.Jump = true
Humanoid:MoveTo(position player is facing)

This? Hope it helps :P

Edit:

To move the camera to a position use cframe. Cframe.new() I think has 6 different parameters group choices meaning there's 6 types of cframe formatting things and the one that makes anything face toward a position is cframe.new(position, position2) position being the position of the instance and position2 being where the instance faces, and its not a relative position, it's world position meaning if you do 0,1,0 for position2 and let's say the instance (the camera of course) is rotated to look down so it's up is actually forward, then it would still go up, because it's not relative to the camera, it's relative to the world, so it would still go 0,1,0 which is a stud up.

Like this I think

Camera.CFrame = CFrame.new(Camera.Position, LookatPos)

I hope this is what you need, if not, I'll help again

2 comments

0

I appreciate this answer so much! However, I should've been more specific. What I'm looking for is that the players camera moves towards the position they're facing.

0

Then use cframe, hold on ill update my answer and if its also not what your looking for then ill fix it until you get ur answer

This discussion is preserved as it was. New answers, comments, and votes are closed.