Ok… I say “Cutscene” here but what is really is, is getting in a locker. When you get in, your camera is fixated to your head, until your in the locker, at which point…
The expected behavior: Your camera stops moving and allows you to look around a little bit by moving mouse around screen
The actual behavior: Camera points at spawnpoint after cutscene plays properly
Script that enables the custcene camera:
local RS = game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")
if not game.Players.LocalPlayer.Character then
game.Players.LocalPlayer.CharacterAdded:Wait()
end
local CutsceneCamera = Instance.new("Camera")
CutsceneCamera.CameraType = Enum.CameraType.Custom
CutsceneCamera.Name = "CutsceneCam"
CutsceneCamera.Parent = workspace
local Camera = workspace.Camera
RS.Visuals.Cutscene.OnClientEvent:Connect(function(inCutscene, Cause)
if inCutscene then
Camera.CameraType = Enum.CameraType.Scriptable
script.CutsceneCamera.Enabled = true
else
Camera.CameraType = Enum.CameraType.Custom
script.CutsceneCamera.Enabled = false
end
if Cause:HasTag("Locker") then
task.wait(1.2)
script.CutsceneCamera.Enabled = false
script.StationaryCamera.Enabled = true
end
end)
The actual cutscene camera script:
local RunService = game:GetService("RunService")
local Player = game:GetService("Players").LocalPlayer
local Camera = workspace:WaitForChild("CutsceneCam")
if not game.Players.LocalPlayer.Character then
game.Players.LocalPlayer.CharacterAdded:Wait()
end
local Character = game.Players.LocalPlayer.Character
workspace.CurrentCamera = Camera
RunService.RenderStepped:Connect(function()
Camera.CFrame = Character.Head.CFrame
print(Camera.CFrame.Position)
end)
The script that should keep the camera in place with the mouse moving where you look at, but doesnt:
local RunService = game:GetService("RunService")
local Player = game:GetService("Players").LocalPlayer
local Camera = workspace:WaitForChild("CutsceneCam")
if not game.Players.LocalPlayer.Character then
game.Players.LocalPlayer.CharacterAdded:Wait()
end
local Character = game.Players.LocalPlayer.Character
workspace.CurrentCamera = Camera
for i = 1, 200 do
print(workspace.CurrentCamera)
print(workspace.CurrentCamera.CameraSubject)
workspace.CurrentCamera.CFrame = Character.Head.CFrame
task.wait(.2)
end
Camera.CameraSubject = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")
RunService.RenderStepped:Connect(function()
Camera.CFrame = Camera.CFrame:Lerp(
CFrame.lookAt(
Vector3.new(0, 10, 0), -- Position Vector3
Player:GetMouse().Hit.Position -- lookAt Vector3
),
0.1 -- must be between 0 and 1! to reduce sensitivity, try reducing the number (this is already 10% of the original speed)
)
end)
Video of the problem:
Any help is appreciated.
BTW! I am going to bed soon after this post. If I don’t reply within like 10 minutes I’m probably asleep and I’ll get back to you tmr