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

How to make the player's bodyThrust force push the way they are facing?

Hello. I'm creating a script where when a player touches a part, a body thrust is created in their HumanoidRootPart, which propels them in whatever direction they are facing. Here is my script:

script.Parent.Touched:Connect(function(touch)
    print(touch.Parent.Name)
    if touch.Parent:FindFirstChild("Humanoid") then
        print("player found!")
        local bodythrust = Instance.new("BodyThrust")
        bodythrust.Parent = touch.Parent.HumanoidRootPart
        bodythrust.Force = Vector3.new(touch.Parent.HumanoidRootPart.CFrame.LookVector, 0)
    end
end)

As you can see, I confuse myself with the look vector part of the script. How would I make the force go in the direction the player is facing?

1 answer

✓ Accepted answer

LookVector is already a Vector3 so you just change line 7 to

bodythrust.Force = touch.Parent.HumanoidRootPart.CFrame.LookVector

In your case it was taking the first argument of the LookVector, X in this case and combined it with 0, this got you a no no result.

1 comment

0

Thank you so much!

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