TweenService is going to struggle with anything involving camera movement because the goal point is serialized and unchangeable upon creation of a Tween. The only way to change it is to make a new tween.
By hooking into Camera.Changed, your code is firing every time the camera changes. When doing anything other than simply positioning the pet, that means many instances of your code are running on top of each other, resulting in undesirable behavior.
This code will allow you to spin a pet:
local render_stepped = game:GetService("RunService").RenderStepped
local camera = workspace.CurrentCamera
local ROTATION_OFFSET = CFrame.Angles(0,0,0) --Modify this if your model does not face the correct orientation.
local SPIN_DURATION = 0.6 --Duration of time in seconds to complete one rotation.
local SPIN_DISTANCE = 1.1 --Studs away from camera to have the model spin.
local pi_2 = 2*math.pi
local spin_connection
local function spin_pet(pet)
if spin_connection then return end
pet.Parent = camera
local current_time = 0
spin_connection = render_stepped:Connect(function(delta_time)
pet.CFrame = (camera.CFrame + (camera.CFrame.LookVector * SPIN_DISTANCE)) *
CFrame.Angles(0,pi_2*(current_time/SPIN_DURATION),0) *
ROTATION_OFFSET
current_time = (current_time + delta_time) % SPIN_DURATION
end)
end
local function stop_spin()
if spin_connection then
spin_connection:Disconnect()
spin_connection = nil
end
end
This code uses two functions to handle movement: spin_pet(pet) and stop_spin(). spin_pet() requires a reference of the pet to spin to be passed to it, but stop_spin() requires nothing. Usage could look something like this:
local pet = workspace.Pet
spin_pet(pet)
task.wait(3)
stop_spin()
This would spin the pet for three seconds. There are a few things to bear in mind with this code, though:
Only one pet can be spun at a time. stop_spin() must be called before a new pet can be spun.
stop_spin() doesn’t do anything besides stopping the spin. The pet will still be parented under workspace.CurrentCamera and simply floating in space. What happens after stopping the spin will need to be handled by your code.
If your pets are not facing the correct direction when using this code, changing the angles of ROTATION_OFFSET will allow you to modify the default orientation of the objects. Moreover, the spin speed and distance from camera can be modified by changing SPIN_DURATION and SPIN_DISTANCE, respectively.