A camera that slightly pans to where your mouse is on my main menu. Ive seen the posts on the devforum here but none of them seem to work. Here is what ive currently got:
local Camera=game.Workspace.Camera
local mouse = game.Players.LocalPlayer:GetMouse()
local rs = game:GetService("RunService")
local fractionToPointAtMouseDestination = 0.5 -- halfway between
local mousep = mouse.Hit.p
local camera = workspace.CurrentCamera
rs.RenderStepped:Connect(function()
local portion = CFrame.new(camera.CFrame.p, camera.CFrame.p + (mousep - camera.CFrame.p).Unit)
camera.CFrame = CFrame.new(camera.CFrame.p, camera.CFrame:Lerp(portion, fractionToPointAtMouseDestination).p)
end)```
it just doesnt work. No errors though.
the function is connected to game:GetService("RunService").RenderStepped, which is being fired every time the game renders. So it’s already a loop, the problem is that mousep isn’t in there
To be honest, besides making sure the CameraType is Enum.CameraType.Attach and not making the CFrame go to part, I don’t know what could be causing the issue