BodyGyro not working

hi, I have this script that’s supposed to move and rotate a pet to a player’s position and rotation. this was working fine until literally 10 minutes ago, I didn’t touch this script but now the pet stays facing one direction and doesn’t rotate at all. the position part works fine, its just the rotation that’s having the issue. any help is appreciated

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)


		local value = player:WaitForChild("Inventory"):WaitForChild("EquippedPet")
		local pet
		if value.Value then 
			pet = value.Value 

			local humRootPart = character.HumanoidRootPart
			local newPet = pet:Clone()
			newPet.Parent = character

			newPet.cube.Anchored = false
			
			local bodyPos = Instance.new("BodyPosition", newPet.cube)
			bodyPos.MaxForce = Vector3.new(math.huge, math.huge, math.huge)

			local bodyGyro = Instance.new("BodyGyro", newPet.cube)
			bodyGyro.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)

			while wait() do
				bodyPos.Position = humRootPart.Position + Vector3.new(2.5,-1,2.5)
				bodyGyro.CFrame = humRootPart.CFrame
			end
		end
	end)
end)

If you didn’t touch this script, maybe another script is causing the problem.

I reverted versions back to when this script was working and it doesn’t seem to be working in the previous versions as well. also, when I open the properties menu for the BodyGyro created by the script, there is no CFrame property. im not sure if its always like this but that’s just something I noticed

I tested your code, and works acceptable.
Looks like theres a problem with using math.huge as the BG max torque.

I changed it to this, and works as intended:
bodyGyro.MaxTorque = Vector3.new(400000, 400000, 400000)

3 Likes

@Dev_Peashie is correct, using a large number instead of infinity should work until this bug is fixed:

2 Likes

Dude I had this exact same problem this morning. I didn’t touch ANYTHING and for some reason my bodygyro broke. Even when I reverted versions back to one that worked, it was still broken. I think it’s a roblox issue and you should probably write something asking what happened.

2 Likes