Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make the player face a certain direction after touching an object?

Asked by 4 years ago

I'm making a wall jumping script and I have it so when you jump onto an object, an animation plays, and you'll be on the wall. The issue is, the player doesn't automatically face the right direction. So the player's hand will be in the air instead of the wall because the player is facing the wrong way. Is there a way to make it so the player faces a certain direction so the animation is correct? Here is my code so far.

function onTouched(hit)
    local human = hit.Parent:findFirstChild("Humanoid")
    if human then
    human.Parent.Animate.Disabled = true
    game.Workspace.walljumppart.CanCollide = true
    local anim = human:LoadAnimation(script.Parent.Animation)
    anim:Play()
    human.WalkSpeed = 0
    end
end
script.Parent.Touched:connect(onTouched)

Thanks

-Ben

1 answer

Log in to vote
0
Answered by
Robowon1 323 Moderation Voter
4 years ago

Try using lookvector: https://scriptinghelpers.org/questions/14747/what-is-lookvector-and-how-do-i-use-it

0
I just tried that but it didn't work. I keep getting the error 'LookVector cannot be assigned to'. Am I doing something wrong? This is my code: human.Parent.HumanoidRootPart.CFrame.LookVector = game.Workspace.lookvectorpart.CFrame.LookVector benawesomeness8954 0 — 4y
Ad

Answer this question