How can I make a Camera Script to move the camera at the beginning of the game?

Hi, I tried to write a script where when the game starts the camera is fully on and seconds later the camera is down to be able to play. I tried to do it with cameraOffset, but I think it would be better to make the script create a block and the camera to be in the block, so that when the block is lowered, the original position is set.

1 Like

You need to be more detail in what you want as I do you understand what you want.

I.E.

  • Menu were the camera rotation is based on the mouse position
  • Camera slowly moves round the map

Oh Im sorry. I try to explain myself well but my English is not my native language.

O now I understand so you want the camera to start at one point and move the the players character

1 Like

Make sure you set the client’s camera type to scriptable first, then you can only set e CFrame of the camera using the scripts.

1 Like

Yes, I tried to do it with the Humanoid Offset Camera but the result is very different.

It can be done using TweenService

(33) Roblox Cutscene Script Tutorial - YouTube

I really didn’t think it would come out. Well, in part it worked but when the camera is finished it does not stick to the head again

Set the camerasubject to the player’s humanoid

local TweenService = game:GetService("TweenService")
local Head = script.Parent:WaitForChild("Head")
local speed = script.Parent:WaitForChild("Humanoid")

speed.WalkSpeed = 0

local parte = Instance.new("Part")
parte.Parent = workspace

local parte2 = Instance.new("Part")
parte2.Parent = workspace

local parte3 = Instance.new("Part")
parte3.Parent = workspace

local weld = Instance.new("Weld")
weld.Parent = parte
weld.Part0 = Head
weld.Part1 = parte
weld.C0 = CFrame.new(0,200,0)

local weld2 = Instance.new("Weld")
weld2.Parent = parte2
weld2.Part0 = Head
weld2.Part1 = parte2
weld2.C0 = CFrame.new(0,100,0)

local weld3 = Instance.new("Weld")
weld3.Parent = parte3
weld3.Part0 = Head
weld3.Part1 = parte3
weld3.C0 = CFrame.new(0,7,0)

parte.Orientation = Vector3.new(-90, 0, 0)
parte2.Orientation = Vector3.new(-90, 0, 0)
parte3.Orientation = Vector3.new(0, 0, 0)

local camera = game.Workspace.Camera
local cutsceneTime = 3

local tweenInfo = TweenInfo.new(
cutsceneTime,
Enum.EasingStyle.Sine,
Enum.EasingDirection.Out,
0,
false,
0)

function tween (parte, parte2, parte3)
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = parte.CFrame
wait(2.5)
local tween = TweenService:Create(camera, tweenInfo, {CFrame = parte2.CFrame})
tween:Play()
wait(3)
local tween2 = TweenService:Create(camera, tweenInfo, {CFrame = parte3.CFrame})
tween2:Play()
end

camera.CameraType = Enum.CameraType.Fixed
camera.CFrame = Head.CFrame
speed.WalkSpeed = 7
tween(parte, parte2, parte3)

At the end of the script:

camera.CameraSubject = variableOfThePlayer.Humanoid

I get the orange line in variableOfThePlayer
and this error
Workspace.NUTRICORP.LocalScript:64: attempt to index nil with 'Humanoid'

Because it means the player object

local player = game.Players.LocalPlayer

camera.CameraSubject = player.Character.Humanoid

Ah, I fixed it, it should be inside the end, not outside