CFrame Help needed. [For a rules cutscene]

I am having some issues getting rid of the camera effect at the end of the cut scene, The code is below if you want to help. I just want the camera to go back to normal.

Code
   
local CurrentCamera = workspace.CurrentCamera

local TweenService = game:GetService("TweenService")
local Players = game:GetService("Players")

local Label = script.Parent.Top.TextLabel
local BackFrame = script.Parent.Back
local TopFrame = script.Parent.Top
local Headshot = TopFrame.ImageLabel





game.ReplicatedStorage.StageCam.OnClientEvent:Connect(function(plrName, Id)
	local Text1 = "Greetings! I am " .. plrName .. " , and I will be your host throughout training session, I’d like to help you leave here successful in your training today!"
	local Text2 = "This is your co host " .. game.workspace.SlidingBoardStage.Value.Value .. "."
	local Text3 = "So lets get started! We will begin by going though some rules!"--So lets get started! We will begin by going though some rules!
	local Text4 = "Rule 1: Follow All Instrucitons, do not troll or cause yourself problems!"
	local Text5 = "Rule 2: Respect everyone equally!"
	local Text6 = "And that is all! Lets get started!"
	local Text7 = "Please await further Instruction!"


	local plrname = workspace.yourname.Value
	print(plrname)

	print(game.workspace.SlidingBoardStage.Value.Value)

	CurrentCamera.CameraType = Enum.CameraType.Scriptable
	CurrentCamera.CameraSubject = workspace.TextFocus1
	CurrentCamera.CFrame = workspace.TextFocus1.CFrame

	local thumbType = Enum.ThumbnailType.HeadShot
	local thumbSize = Enum.ThumbnailSize.Size420x420
	local content, isReady = Players:GetUserThumbnailAsync(Id, thumbType, thumbSize)

	TopFrame.Visible = true
	BackFrame.Visible = true
	Headshot.Image = content

	local StageTweenInfo = TweenInfo.new(5, Enum.EasingStyle.Linear, Enum.EasingDirection.In)
	local StageGoal = {CFrame = workspace.TextFocus2.CFrame}
	local StageTween = TweenService:Create(CurrentCamera, StageTweenInfo, StageGoal)

	StageTween:Play()
	for i = 1, #Text1 do
		Label.Text = string.sub(Text1, 1, i)
		wait(.045)
	end

	CurrentCamera.CameraSubject = workspace.TextFocus3
	CurrentCamera.CFrame = workspace.TextFocus3.CFrame

	local StageGoal2 = {CFrame = workspace.TextFocus4.CFrame}
	print("change")
	local StageTween2 = TweenService:Create(CurrentCamera, StageTweenInfo, StageGoal2)
	StageTween2:Play()

	wait(2.5)

	for i = 1, #Text2 do
		Label.Text = string.sub(Text2, 1, i)
		wait(.045)
	end

	CurrentCamera.CameraSubject = workspace.TextFocus5
	CurrentCamera.CFrame = workspace.TextFocus5.CFrame

	local StageGoal3 = {CFrame = workspace.TextFocus6.CFrame}
	print("change")
	local StageTween3 = TweenService:Create(CurrentCamera, StageTweenInfo, StageGoal3)
	StageTween3:Play()

	wait(2.5)

	for i = 1, #Text3 do
		Label.Text = string.sub(Text3, 1, i)
		wait(.045)
	end

	CurrentCamera.CameraSubject = workspace.TextFocus7
	CurrentCamera.CFrame = workspace.TextFocus7.CFrame

	local StageGoal4 = {CFrame = workspace.TextFocus8.CFrame}
	print("change")
	local StageTween4 = TweenService:Create(CurrentCamera, StageTweenInfo, StageGoal4)
	StageTween4:Play()

	wait(2.5)

	for i = 1, #Text4 do
		Label.Text = string.sub(Text4, 1, i)
		wait(.045)
	end
	---------------------------------------------------------------


	CurrentCamera.CameraSubject = workspace.TextFocus9
	CurrentCamera.CFrame = workspace.TextFocus9.CFrame

	local StageGoal5 = {CFrame = workspace.TextFocus10.CFrame}
	print("change")
	local StageTween5 = TweenService:Create(CurrentCamera, StageTweenInfo, StageGoal5)
	StageTween5:Play()

	wait(2.5)

	for i = 1, #Text5 do
		Label.Text = string.sub(Text5, 1, i)
		wait(.045)
	end
	CurrentCamera.CameraSubject = workspace.TextFocus11
	CurrentCamera.CFrame = workspace.TextFocus11.CFrame

	local StageGoal6 = {CFrame = workspace.TextFocus12.CFrame}
	print("change")
	local StageTween6 = TweenService:Create(CurrentCamera, StageTweenInfo, StageGoal6)
	StageTween6:Play()

	wait(2.5)

	for i = 1, #Text6 do
		Label.Text = string.sub(Text6, 1, i)
		wait(.045)
	end
	CurrentCamera.CameraSubject = workspace.TextFocus13
	CurrentCamera.CFrame = workspace.TextFocus13.CFrame

	local StageGoal7 = {CFrame = workspace.TextFocus14.CFrame}
	print("change")
	local StageTween7 = TweenService:Create(CurrentCamera, StageTweenInfo, StageGoal7)
	StageTween7:Play()

	wait(2.5)

	for i = 1, #Text7 do
		Label.Text = string.sub(Text7, 1, i)
		wait(.045)
	end    

	wait(5)

	    local character = Players.LocalPlayer.Character
	    local torso = character:WaitForChild("HumanoidRootPart")
	    CurrentCamera.CameraSubject = workspace.intorsetorpolice1.HumanoidRootPart
		local StageGoal8 = {CFrame = workspace.intorsetorpolice1.HumanoidRootPart}
		local StageTween8 = TweenService:Create(CurrentCamera, StageTweenInfo, StageGoal8)
		StageTween8:Play()

		wait(2.5)
		
		
		   

	

	print("Reet camera.")
	end)
 

Thanks, Intor.

Add this where ever in the script you want to revert the camera back to normal.

    CurrentCamera.CameraType = Enum.CameraType.Custom
    CurrentCamera.CameraSubject = character:WaitForChild("Humanoid")

I will try that now, Thanks! :slight_smile:


https://gyazo.com/9a3eb06e032f468b763a69649294c3ef

Sorry try this:

    local character = Players.LocalPlayer.Character or Players.LocalPlayer.CharacterAdded:Wait()
    CurrentCamera.CameraType = Enum.CameraType.Custom
    CurrentCamera.CameraSubject = character:WaitForChild("Humanoid")
1 Like

Thank you for your help. You get a follow you are a star!

Maybe you can help on my other post? XD

https://devforum.roblox.com/t/i-need-some-help-with-roblox-names/1268068/3

How would i make a button that does this also?

If you mean a Gui button you can connect a function to when it is clicked, and put the code inside of it.

no idea how to do that but i guess ill try. :frowning:

local button = -- put in the variable for the button
button.MouseButton1Down:Connect(function()
    -- Insert the code here
end)
2 Likes

Ok thanks, just tested it, it well. Half works. But keeps putting me back in is there a way i can have it loop the code for like 30 seconds?

Which code do you want to loop?

	local character = Players.LocalPlayer.Character or Players.LocalPlayer.CharacterAdded:Wait()
	CurrentCamera.CameraType = Enum.CameraType.Custom
	CurrentCamera.CameraSubject = character:WaitForChild("Humanoid")
local run = game:GetService("RunService")
local done = false

run.RenderStepped:Connect(function()
if not done then
	local character = Players.LocalPlayer.Character or Players.LocalPlayer.CharacterAdded:Wait()
	CurrentCamera.CameraType = Enum.CameraType.Custom
	CurrentCamera.CameraSubject = character:WaitForChild("Humanoid")
     end
end)

courintine.wrap(function)
    wait(30) 
    done = true
end)()

ik formating bad sry

i got an error {red line}

https://gyazo.com/e37b2b2df51f088481b3eae88173ee60

sorry change it to “corountine”
;p


https://gyazo.com/19819b3eefa8137316095cf62ce565f1

still got an error line.

image

oops its “coroutine” im so sorry