Need help with main menu

So i have a script for my main menu that when u move your mouse the camera moves too.
but the problem is that the script puts my camera in the middle of the map.

the script:

local Camera = game.Workspace.CurrentCamera
local CamPart = game.Workspace.CamPart
local GuiButton = game.StarterGui.ScreenGui.PlayButton
local localPlayer = game:GetService("Players").LocalPlayer
local char = localPlayer.Character or localPlayer.CharacterAdded:Wait()



repeat wait() until Camera.CameraSubject ~= nil

Camera.CameraType = Enum.CameraType.Scriptable
Camera.CFrame = CamPart.CFrame

local Mouse = game.Players.LocalPlayer:GetMouse()
local Camera = game.Workspace.CurrentCamera

local DefaultCFrame = Camera.CFrame
local Scale = 200

function Update()
	local Center = Vector2.new(Camera.ViewportSize.X/2, Camera.ViewportSize.Y/2)
	local MoveVector = Vector3.new((Mouse.X-Center.X)/Scale, (Mouse.Y-Center.Y)/Scale, 0)
	Camera.CFrame = DefaultCFrame * CFrame.new(DefaultCFrame.p + MoveVector)
end


game:GetService("RunService").RenderStepped:Connect(Update) 

script.Parent.PlayButton.MouseButton1Click:Connect(function()
	Camera.CameraType = Enum.CameraType.Custom
end)



I’m looking at your code and the script should set your camera to the CFrame of variable CamPart. I don’t see anything wrong with that. If you move around CamPart does the camera remain in the same place?

if i move CamPart it just stays in place

I took your code and put it into an empty baseplate and when I move the part around, my camera gets set to where I move it. You should double check that the part you’re moving is named properly and there isn’t duplicate CamParts.

i just deleted campart and added a new one