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

How can I can a part to look Where the player is facing at?(BodyGyro)

I want it so that the a part will face where ever the player is facing or its LookVector. How can i do that. This is my attempt:

while true do
local Part = Instance.new("Part")
Part.Parent = workspace
Part.CanCollide = false
Part.Anchored = false
		local bg = Instance.new("BodyGyro")
		bg.Parent = Part
		bg.MaxTorque = Vector3.new(0,math.huge,0)
        bg.CFrame = CFrame.new(Player.Character.Torso.Position, Player.Character.Torso.LookVector)
end

1 comment

0

Can I Can I Can I Can I Can I Can I Can I Can I Can I Can I Can I Can I

2 answers

CFrame.new(Vector3 pos, Vector3 lookAt)

You can set a part's CFrame to look at any object in the current 3D space.

All you need to do is change:

Player.Character.Torso.Position, Player.Character.Torso.LookVector

To:

Player.Character.Torso.CFrame.Position, Player.Character.Torso.CFrame.LookVector

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