Still have questions? Join our Discord server and get real time help.
Log in to vote

BodyGyro not looking at Target?

Asked by 1 year ago
Edited 1 year ago

The BodyPosition is working fine but the BodyGyro is not looking at TARGET no matter what I do.

local RocketCopy = module.LaserShoot(EquippedRocket) -- Module with Custom Parts
local Rocket = RocketCopy:Clone() 
Rocket.CFrame = 
Rocket.Parent = workspace
debris:AddItem(Rocket, 2)

local BodyPosition ="BodyPosition", Rocket)
BodyPosition.MaxForce =,65,50)
BodyPosition.D = 1800
BodyPosition.P = 48000

local bodyGyro ="BodyGyro",Rocket)
bodyGyro.MaxTorque =,80000,80000)
bodyGyro.P = 25000
bodyGyro.D = 700
BodyPosition.Position = workspace.TARGET.Position

local function TargetLook()
    while Rocket.Parent ~=nil do
        bodyGyro.CFrame =,workspace.TARGET.CFrame.LookVector *100)

spawn(function()TargetLook() end)

2 answers

Log in to vote
Answered by
Rare_tendo 2431 Moderation Voter Community Moderator
1 year ago

Unlike's 2nd parameter as a direction relative to the origin,, lookAt) constructor's 2nd parameter is a vector in world space.

You'll need to do:

lua BodyGyro.CFrame =, Rocket.Position + workspace.TARGET.CFrame.lookVector * 100)

still not working, the rocket keep looking at one direction all time iagometroid 61 — 1y
instead of TARGET I change to Character.Torso and works fine, i dont understand why TARGET dont work... iagometroid 61 — 1y
Log in to vote
Answered by 1 year ago

What you can do to make the BodyGyro face the target is set the CFrame of BodyGyro to the Rocket and Target's position.

Something like this:

BodyGyro.CFrame =, workspace.TARGET.Position)

Answer this question