Hey there! so i have this camera rotation system in place and when i activate the rotation, it just instantly snaps. How would i make it so it quickly tweens into rotation?
local status = 0
local camera = workspace.CurrentCamera
local rss = game:GetService("RunService")
local angle = 0
local rate = 20 / 0
local function rotate()
camera.FieldOfView = 90
rss.RenderStepped:Connect(function()
camera.CFrame = CFrame.lookAt(camera.CFrame.Position, camera.CFrame.Position + camera.CFrame.LookVector) * CFrame.Angles(0, 0, math.rad(angle))
end)
if (status == 0) then
status = 2
while (angle < 20) do
local t = rss.RenderStepped:Wait()
angle = angle + rate * t
end
angle = 20
status = 1
end
end
game.ReplicatedStorage.WallrunTilt.OnClientEvent:Connect(function(e)
if e == "start" then
rotate()
else
camera.FieldOfView = 70
status = 2
while (angle > 0) do
local t = rss.RenderStepped:Wait()
angle = angle - rate * t
end
angle = 0
status = 0
end
end)
thanks! im pretty bad at CFrames and tweening so yeah…