The code that I rewritten many times was pretty shit so I was wondering if I could get some help? The script is supposed to pan to the Player if he enters your house.
if (game.Workspace.House.Position - game.Players:GetPlayers().Position).magnitude < 15 then game.Workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable game.Workspace.CurrentCamera.CFrame = game.Workspace.CurrentCamera.CFrame:Lerp(game.Players:GetPlayers().CFrame) else game.Workspace.CurrentCamera.CameraType = Enum.CameraType.Custom end
I had to figured it out myself, thanks a lot guys.
wait(2) local RunService = game:GetService("RunService") RunService.RenderStepped:Connect(function() local magnitude = (game.Players.LocalPlayer.Character:FindFirstChild("Head").Position - workspace:FindFirstChild("Part").Position).Magnitude if magnitude < 15 then workspace.CurrentCamera.CameraSubject=game.Workspace:FindFirstChild("Part") else print(magnitude) workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character:FindFirstChild("Humanoid") end end)