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

How do you create an object in front of a player?

So far I create the object to a certain side of the player, no matter which direction he is facing.

shield.Position=spawnPos+Vector3.new(0,0,5)

How do you make it so it spawns directly in front of you no matter where you're facing?

1 answer

✓ Accepted answer

It's as simple as this:

shield.CFrame = spawnCFrame * CFrame.new(0, 0, 5):inverse()

So, when positioning, you should use CFrame instead, otherwise the part would get placed above parts that are in the way.

Also, as variable spawnCFrame suggests, you should have the CFrame of the origin(torso I guess), not position, like in your original script.

1 comment

0

Understood, thanks for clearing that up :)

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