I have a script that uses a cut scene as a menu screen. I want to make it so that when someone clicks q the camera switches back to the player’s view. Though it doesn’t work.
local TweenService = game:GetService("TweenService")
local camera = game.Workspace.Camera
local cutscenceTime = 5
local tweenInfo = TweenInfo.new(
cutscenceTime,
Enum.EasingStyle.Sine,
Enum.EasingDirection.Out,
0,
false,
0
)
function tween(part1, part2)
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = part1.CFrame
local tween = TweenService:Create(camera, tweenInfo, {CFrame = part2.CFrame})
tween:Play()
wait(cutscenceTime)
local UserInputService = game:GetService("UserInputService")
UserInputService.InputBegan:Connect(function(input, gameProcessedEvent)
if input.UserInputType == Enum.UserInputType.Keyboard then
if input.Keycode == Enum.KeyCode.Q then
camera.CameraType = Enum.CameraType.Custom
end
end
end)
end
wait(2)
tween(game.Workspace.Home1,game.Workspace.Home2)
local TweenService = game:GetService("TweenService")
local camera = game.Workspace.Camera
local cutscenceTime = 5
local tweenInfo = TweenInfo.new(
cutscenceTime,
Enum.EasingStyle.Sine,
Enum.EasingDirection.Out,
0,
false,
0
)
local Player = game.Players.LocalPlayer -- NEW PART --
function tween(part1, part2)
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = part1.CFrame
local tween = TweenService:Create(camera, tweenInfo, {CFrame = part2.CFrame})
tween:Play()
wait(cutscenceTime)
local UserInputService = game:GetService("UserInputService")
UserInputService.InputBegan:Connect(function(input, gameProcessedEvent)
if input.UserInputType == Enum.UserInputType.Keyboard then
if input.Keycode == Enum.KeyCode.Q then
camera.CameraType = Enum.CameraType.Custom
camera.CameraSubject = Player.Character.Humanoid -- NEW PART --
end
end
end)
end
wait(2)
tween(game.Workspace.Home1,game.Workspace.Home2)
local TweenService = game:GetService("TweenService")
local camera = game.Workspace.Camera
local cutscenceTime = 5
local tweenInfo = TweenInfo.new(
cutscenceTime,
Enum.EasingStyle.Sine,
Enum.EasingDirection.Out,
0,
false,
0
)
local Player = game.Players.LocalPlayer -- NEW PART --
function tween(part1, part2)
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = part1.CFrame
local tween = TweenService:Create(camera, tweenInfo, {CFrame = part2.CFrame})
tween:Play()
wait(cutscenceTime)
local UserInputService = game:GetService("UserInputService")
UserInputService.InputBegan:Connect(function(input, gameProcessedEvent)
if input.Keycode == Enum.KeyCode.Q then
camera.CameraType = Enum.CameraType.Custom
camera.CameraSubject = Player.Character.Humanoid -- NEW PART --
end
end)
end
wait(2)
tween(game.Workspace.Home1,game.Workspace.Home2)
local TweenService = game:GetService("TweenService")
local uis = game:GetService("UserInputService")
local camera = game.Workspace.Camera
local cutscenceTime = 5
local tweenInfo = TweenInfo.new(
cutscenceTime,
Enum.EasingStyle.Sine,
Enum.EasingDirection.Out,
0,
false,
0
)
local Player = game.Players.LocalPlayer
function tween(part1, part2)
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = part1.CFrame
local tween = TweenService:Create(camera, tweenInfo, {CFrame = part2.CFrame})
tween:Play()
wait(cutscenceTime)
uis.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.Q and uis:GetFocusedTextBox() == nil then
camera.CameraSubject = Player.Character.Humanoid
camera.CameraType = Enum.CameraType.Custom
end
end)
end
wait(2)
tween(game.Workspace.Home1,game.Workspace.Home2)