trying to make a simple menu screen where the camera follows the cursor, but the tween is really… not good. any ideas on what i can do please feel free to share
-- cc = current camera, campart1 = the camera part
local mouse = game.Players.LocalPlayer:GetMouse()
cc.CameraSubject = mouse
local debounce = false
mouse.Move:Connect(function()
if not debounce then
cc.CameraSubject = mouse
cc.CFrame = campart1.CFrame
local tween = tws:Create(cc, TweenInfo.new(), {CFrame = CFrame.new(campart1.Position, mouse.Hit.p)})
tween:Play()
debounce = true
tween.Completed:Wait()
debounce = false
end
end)
Greetings, I have been using this script for awhile for alot of my games and it has worked really well for me. If you need help best suiting it for your use case please let me know but this is the basics on how I have it set up!
local Mouse = game.Players.LocalPlayer:getMouse()
local Camera = game.Workspace.CurrentCamera
local CameraPart = workspace:WaitForChild("CameraPart")
local Scale = 200 --The lower the number is the more does your camera follow your mouse
function Update()
local Center = Vector3.new(Camera.ViewportSize.X/2, Camera.ViewportSize.Y/2)
local MoveVector = Vector3.new((Mouse.X-Center.X)/Scale, (Mouse.Y-Center.Y)/Scale, 10)
Camera.CFrame = CameraPart.CFrame * CFrame.Angles(math.rad(-(Mouse.Y-Center.Y)/Scale),math.rad(-(Mouse.X-Center.X)/Scale),0)
end
game["Run Service"].RenderStepped:Connect(Update)