So I have this game, where when a round ends, the players are teleported to the lobby via player:LoadCharacter
(I load their character instead of TPing them because the only spawns in the game are in the lobby, and this also neatly removes SpotLight
s, Tool
s and similar objects from the player). However, before they get "teleported", I want each player to see a "cutscene"/cinematic, which consists of their camera moving to look at a certain object. How I do this is that I have an event, which is fire to all player client who participated in the match, from a ServerScript. In a LocalScript under the player, it receives this event, and does this:
--cinematicSpeed = 5 local function doCinematic() print("Cinematic request") clientSounds.EndBells:Play() local camera = game.Workspace.CurrentCamera camera.CameraType = Enum.CameraType.Scriptable local tweenInfo = TweenInfo.new(cinematicSpeed) local movePosition = CFrame.new(2388.22705, 172.639359, -801.751831, -0.91318661, 0.174258858, 0.368407518, -1.49011612e-08, 0.90397495, -0.427585363, -0.407541722, -0.39046523, -0.825497806) local tween = TweenService:Create(camera, tweenInfo, {CFrame = movePosition}) tween.Parent = camera tween:Play() tween.Completed:Wait() camera.CameraType = Enum.CameraType.Custom tween:Destroy() end
The Script that fires the event fires the even for a player, than waits two seconds, and then "teleports" the player. The problem is, after the cutscene plays, the camera snaps back to where it was before the cutscene began, which is usually above the battlefield, and stays there indefinitely.
How can I fix this? Is it simply a question of not setting the camera type to Scriptable
? Or will just Destroy()
ing the old camera generate a new one and fix it? Or is it un-fixable, and I just have to reset the players and THEN call the cutscene?
Delete the camera. That's all there is to it. :P