Howdy.
I hardly even know how to use camera manipulation, this is from the developer wiki. Player | Roblox Creator Documentation if one can help me, it’d be great. I’m trying to get the camera back to normal after an event is fired. Everything else works fine, it just doesn’t switch back.
Script uno
local function official()
local TweenService = game:GetService("TweenService")
local RunService = game:GetService("RunService")
local target = workspace:FindFirstChild("CameraFocus")
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
local rotationAngle = Instance.new("NumberValue")
local tweenComplete = false
local cameraOffset = Vector3.new(0, 10, 12)
local rotationTime = 15
local rotationDegrees = 360
local rotationRepeatCount = -1
local lookAtTarget = true
local function updateCamera()
if not target then return end
camera.Focus = target.CFrame
local rotatedCFrame = CFrame.Angles(0, math.rad(rotationAngle.Value), 0)
rotatedCFrame = CFrame.new(target.Position) * rotatedCFrame
camera.CFrame = rotatedCFrame:ToWorldSpace(CFrame.new(cameraOffset))
if lookAtTarget == true then
camera.CFrame = CFrame.new(camera.CFrame.Position, target.Position)
end
end
local tweenInfo = TweenInfo.new(rotationTime, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, rotationRepeatCount)
local tween = TweenService:Create(rotationAngle, tweenInfo, {Value=rotationDegrees})
tween.Completed:Connect(function()
tweenComplete = true
end)
tween:Play()
RunService.RenderStepped:Connect(function()
if tweenComplete == false then
updateCamera()
end
end)
end
game.ReplicatedStorage.TerminalValues.Misc.cameraTrigger.OnClientEvent:Connect(function()
official()
end)
Script two (i decided to be lazy)
game.ReplicatedStorage.TerminalValues.Misc.cameraTrigger.OnClientEvent:Connect(function()
wait(5)
workspace.CurrentCamera.CameraType = Enum.CameraType.Fixed
end)
I may not respond instantly, I’m about to leave for football.
Thanks!