Hello. I am trying to create a piece of code that spawns a part in front of the player, but the direction the player is facing will cause the part to spawn at the back of the player at times. What I want to know is if there is a function or event that will execute a block of code depending on the direction a player is facing. Thank you.
You just use the players Torso
CFrame then just add an offset to it.
Simple Example:-
1 | local a = Instance.new( 'Part' , game.Workspace) |
2 | -- we use the players Torso CFrame |
3 | a.CFrame = game.Workspace.Player 1. Torso.CFrame * CFrame.new( 0 , 0 ,- 2 ) -- this is the offset |
I hope this helps.