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!
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