So I was making a test of a door 100 cutscene when I stumbled on an issue. I can still move my camera. Here is the video.
Any ideas that can improve the cutscene?
This is my script.
local ts = game:GetService("TweenService")
local part = workspace:WaitForChild("LookCam")
local parttarget = workspace:WaitForChild("LookCamTarget")
local camera = workspace.CurrentCamera
local tweeninfo = TweenInfo.new(
4,
Enum.EasingStyle.Cubic,
Enum.EasingDirection.InOut,
0,
false,
0
)
--moves to the lookcam target
local tween = ts:Create(part, tweeninfo, {CFrame = parttarget.CFrame})
local event = game.ReplicatedStorage.Events:WaitForChild("GateOpen")
event.OnClientEvent:Connect(function(player: Player)
camera.CameraType = Enum.CameraType.Attach --camera settings
camera.CameraSubject = part
player.Character.HumanoidRootPart.Anchored = true
local c = player.Character
--player becomes invisible smoothly
local tweeninfo2 = TweenInfo.new(
0.5,
Enum.EasingStyle.Cubic,
Enum.EasingDirection.InOut,
0,
false,
0
)
--variable that detects every part in the player
for i, v in pairs(c:GetDescendants()) do
if v:IsA("MeshPart") then
local tween2 = ts:Create(v, tweeninfo2, {Transparency = 1})
tween2:Play()
tween:Play()
end
end
end)
I’d recommend using the Scriptable Enum camera type to tween your camera, which may solve your issue. Additionally if you want your cutscene to look more cinematic, you can interpolate the camera’s CFrame in between two parts (set its CFrame to part A and tween it to part B’s CFrame).
Edit: If you want to make it even more cinematic, you can add some “cinematic bars” as a UI with two black frames.
Always make sure to set the camera type back to Custom after, and hope this helps :D!
local ts = game:GetService("TweenService")
local part = workspace:WaitForChild("LookCam")
local parttarget = workspace:WaitForChild("LookCamTarget")
local camera = workspace.CurrentCamera
local tweeninfo = TweenInfo.new(
4,
Enum.EasingStyle.Cubic,
Enum.EasingDirection.InOut,
0,
false,
0
)
--moves to the lookcam target
local tween = ts:Create(part, tweeninfo, {CFrame = parttarget.CFrame})
local event = game.ReplicatedStorage.Events:WaitForChild("GateOpen")
event.OnClientEvent:Connect(function(player: Player)
camera.CameraType = Enum.CameraType.Scriptable --camera settings
camera.CFrame = part.CFrame
player.Character.HumanoidRootPart.Anchored = true
local c = player.Character
--player becomes invisible smoothly
local tweeninfo2 = TweenInfo.new(
0.5,
Enum.EasingStyle.Cubic,
Enum.EasingDirection.InOut,
0,
false,
0
)
--variable that detects every part in the player
for i, v in pairs(c:GetDescendants()) do
if v:IsA("MeshPart") then
local tween2 = ts:Create(v, tweeninfo2, {Transparency = 1})
tween2:Play()
tween:Play()
end
end
end)
What’s going on in your current code is that you’re tweening one part to move to another, and doing that for every part within your character (since you incorporated it in the loop at the end).