I am trying to make the torso point towards the mouse using body gyro(not cframe, I know how to do it with cframe) I cant seem to get it right because it keeps spamming out, I am using bodyvelocity and body gyro to keep the player suspended in air,(side not: should I use body position instead for that?). Its for a flight script.
COMMUNITY QUESTION
How do I use bodygyro to aim a players torso?
1 answer
The BodyGyro's CFrame property represents the desired rotation of the part. Therefore, you need to set BodyGyro.CFrame to a CFrame at the torso's position pointing towards the position component of mouse.Hit.
local player = game.Players.LocalPlayer
local character = player.Character
local torso = character.Torso
local bodyGyro = torso.BodyGyro
local mouse = player:GetMouse()
mouse.Move:connect(function()
bodyGyro.CFrame = CFrame.new(torso.Position, mouse.Hit.p)
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.
