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

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

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

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.

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