[SOLVED] BodyGyro is not setting the CFrame

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!

I just want one of my CFrames to look at the other.

  1. What is the issue? Include screenshots / videos if possible!

This is a client script by the way)

The basepart is not looking at the camera. Originally, I was just setting the CFrame without bodygyros because it didn’t seem like there was a need.

but when I used the character’s baseparts I needed to use bodygyros to make it smooth and work properly because the turning was working but it would be laggy and teleport the player back and forth.

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I tried setting networkownership to the player, that hasn’t worked.

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

-- Local script
local BodyGyro = Instance.new("BodyGyro", Head)

Mouse.Button2Down:Connect(function()
	RightMouseHeld = true
	while RightMouseHeld == true do
-- The cframe is not looking at the other
		BodyGyro.CFrame = CFrame.lookAt(-Head.CFrame.Position, -Camera.CFrame.Position)
		task.wait()
	end
end)

Mouse.Button2Up:Connect(function()
	RightMouseHeld = false
end)

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

you need to increase the MaxTorque y value

BodyGyro.MaxTorque = Vector3.new(1000000,1000000,1000000)

Didn’t work :frowning:

I’m not sure why this is happening, the player owns the basepart. So this is just weird…

I’m pretty sure if I did it on the server this would not be an issue but the problem is that I don’t want other players to see this.

if the character is the local player character it should work fine from a local script, i tested this local script in startercharacterscripts and it works

local bg = Instance.new("BodyGyro")
bg.Parent = game.Players.LocalPlayer.Character:WaitForChild("Head")
bg.MaxTorque = Vector3.new(1000000,1000000,1000000)
while task.wait() do
	bg.CFrame = CFrame.lookAt(game.Players.LocalPlayer.Character.Head.Position, workspace.CurrentCamera.CFrame.Position)
end

however even though this is in a local script it will be visible to other players in the server as any physics done by a player on their character is replicated to the server

Then why isn’t mine working??

local BodyGyro = Instance.new("BodyGyro")
BodyGyro.MaxTorque = Vector3.new(1000000,1000000,1000000)
BodyGyro.Parent = Head

Just tried checking if that was the case in a local server on studio and nope, it’s all client-sided.

This topic has still not been solved

I am so sorry! Your answer was technically correct, I didn’t realise I had the basepart anchored and this caused the part to not move! I’m sorry my code was very long that I didn’t notice. So I will technically mark you down as the solution. Thanks for the help.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.