Want:
I want the player’s camera to move to CameraPart before and after each round. Once the round starts, the camera should follow the HeadCamera’s CFrame and then allow the player to use the camera normally.
Problem:
The camera correctly follows the HeadCamera’s CFrame during the first round but fails to do so in subsequent rounds.
How do I fix this?
Code:
local Player = game.Players.LocalPlayer
local Camera = game.Workspace.CurrentCamera
local CameraPart = game.Workspace.Lobby:WaitForChild("CameraPart")
local GameEvent = game.ReplicatedStorage.RemoteEvents.GameEvent
local HeadCamera = Player.Character.HeadCamera
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CFrame = CameraPart.CFrame
GameEvent.OnClientEvent:Connect(function(Message)
if Message == "Ready" then
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CFrame = HeadCamera.CFrame
task.wait(0.25)
Camera.CameraType = Enum.CameraType.Custom
elseif Message == "EndGame" then
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CFrame = CameraPart.CFrame
end
end)