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

How may I push a player to what the player is looking at?

Asked by 3 years ago

Hi! So in my game, I'm trying to develop a telekinetic Push ability however When the player presses the keybind, The player gets pushed behind the player or some other unwanted direction. I have some understanding of lookvectors yet it doesn't seem to work well.

This code is stored in a module script, which is triggered thru a remote event, the remote event is triggered by a local script that detects the keybind.

Thank you for anyone helping in advance.

       local Push = Instance.new("BodyVelocity")
    Push.Parent = victim.HumanoidRootPart
    Push.Velocity = (HumanoidRP.Position) + Vector3.new(30,15,30)

                                                                 --(X, Y, Z)
    wait(timelimit)
    Push:Destroy()

1 answer

Log in to vote
0
Answered by 3 years ago

So I recieved Help in another website but if Anyone has the same problem I did with having the Lookvector of the players camera (game.workspace.CurrentCamera.CFrame.LookVector) and multiplying it with a vector. You might see the player not moving much so you can just increase the power of the velocity.

Ad

Answer this question