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

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

Asked by 5 years ago

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
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 awesomeipod 607 — 5y

2 answers

Log in to vote
1
Answered by
waifuSZN 123
5 years ago
Edited 5 years ago
CFrame.new(Vector3 pos, Vector3 lookAt)

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

Ad
Log in to vote
0
Answered by
DaR3ka 0
5 years ago

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

Answer this question