Hi everyone! Currently working on a new game of mine and I made a custom camera for the menu! However, I need to know how I would change the camera to the default one when you click the deploy button. I’ve already tried to use camera.CameraType = Enum.CameraType.Custom, but that didn’t work for some reason.
The Camera Part is located in workspace and is called campart. Here’s the actual camera script that sets the camera to the part.
local mouse = game.Players.LocalPlayer:GetMouse()
local cam = workspace.CurrentCamera
local camPart = workspace.campart
local Scale = 500
cam.CameraType = Enum.CameraType.Scriptable
game:GetService("RunService").RenderStepped:Connect(function()
local center = Vector2.new(cam.ViewportSize.X/12, cam.ViewportSize.Y/12)
local x = mouse.X - center.X / 12
local y = mouse.Y - center.Y / 12
local xOffset = x/Scale
local yOffset = y/Scale
local lookAtPoint = camPart.Position+camPart.CFrame.LookVector*15
local vector = Vector3.new(
lookAtPoint.X - xOffset,
lookAtPoint.Y - yOffset,
lookAtPoint.Z - xOffset)
local result = CFrame.lookAt(camPart.CFrame.Position,vector)
cam.CFrame = result
end)
Any help is appreciated!