so like i have a camera for my menu. the camera tilts with where the mouse is, basically the camera is perfect. but what im looking for is a way to toggle this camera so the perspective can go back to the player’s character whenever i want. right now im just using renderstepped to repeat it forever and i actually dont know how to switch it. pls go easy on me im barely know anything in scripting
local cam = workspace.Camera
local mouse = game:GetService("Players").LocalPlayer:GetMouse()
local maxTilt = 30
game:GetService("RunService").RenderStepped:Connect(function()
if false then
cam.CFrame = CFrame.lookAt(game.Workspace.Head.Position,game.Workspace.Part.Position)
else
cam.CFrame = game.Workspace.Head.CFrame * CFrame.Angles(
math.rad((((mouse.Y - mouse.ViewSizeY / 2) / mouse.ViewSizeY)) * -maxTilt),
math.rad((((mouse.X - mouse.ViewSizeX / 2) / mouse.ViewSizeX)) * -maxTilt),0)
end
end)
thanks