How to stop camera movement script?

Hey, there! I recently made a script on a spinning camera system. It works great except… I have no idea how to stop the camera effect.


local RunService = game:GetService('RunService')
local localCharacter = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()
local camera = workspace:WaitForChild('Camera')
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = * CFrame.Angles(0, 0, 0)

local centerCFrame =,75,0) -- center of the rotation
local offsetCFrame =,0,50) -- 50 stud radius (moves it backwards)
local currentAngle = 0 -- in degrees

function rotateCamera()
	camera.CFrame = centerCFrame*CFrame.Angles(0,math.rad(currentAngle),0)*offsetCFrame
	currentAngle = currentAngle + 0.2
RunService:BindToRenderStep('CameraRotation', Enum.RenderPriority.Camera.Value + 0.2, rotateCamera)


1 Like

When the player clicks the Play button I am pretty sure you could just do this:


It works, thank you! Also, do you know any other way that I could make this smother or something.

I think you could try CFrame:Lerp() or if you want, you can use TweenService (I would use TweenService but its your choice).

Well, how would I use tween service while using UnbindFromRenderStep. UnbindFromRenderStep instantly stops the process.

I can’t see the difference from that to you using CFrames, don’t they stop too?

I never said I would use CFrames, I’m just wondering how to use tween service in my case if UnbindFromRenderStep is the only way to “reset” the characters camera.

Oh, sorry. This time you wouldn’t use RenderStep at all. You would initiate the tween and then when the Play button is pressed you can do Tween:Cancel(). If you want the list of functions etc. you can see them here.

To make the tween loop forever (until you Cancel/Pause) you have to set the RepeatCount to -1. (TweenService | Roblox Creator Documentation)

local tweenInfo =
	2, -- Time
	Enum.EasingStyle.Linear, -- EasingStyle
	Enum.EasingDirection.Out, -- EasingDirection
	-1, -- RepeatCount (when less than zero the tween will loop indefinitely)
	true, -- Reverses (tween will reverse once reaching it's goal)
	0 -- DelayTime

If you have problems with Cancel() you can try Pause().