Hey there, I am working on a starting screen for my game and I want it so that the camera follows the mouse slightly like the mimic on the starting screen. Any help is appreciated!
2 Likes
I think this is the answer you are looking for.
--// Variables
local cam = workspace.CurrentCamera
local camPart = workspace["CameraPart"]
local mouse = game:GetService("Players").LocalPlayer:GetMouse()
--// Set cam
repeat
wait()
cam.CameraType = Enum.CameraType.Scriptable
until
cam.CameraType == Enum.CameraType.Scriptable
--// Move cam
local maxTilt = 10
game:GetService("RunService").RenderStepped:Connect(function()
cam.CFrame = camPart.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)
3 Likes
Thanks! Now I will be able to make a starting screen.