Its obviously getting stuck in the while wait() do loop. You probably want to use a boolean to control the while wait do loop.
Basically, I added a boolean called MouseEntered which stands for if the mouse entered the button, it then repeats the code previously surrounded with while wait() do, but this time it is controlled by a boolean, so while MouseEntered is true, it will run that code. Then you have to add the wait into the while MouseEntered do loop so that it doesn't crash. Lastly, when the MouseButton1Down is called it stops the while MouseEntered loop by setting MouseEntered to false.
If you go back to the MouseEntered function it will resume the while MouseEntered loop.
01 | Torso = script.Parent.Parent.Parent.Parent.Parent.Character:WaitForChild( "Torso" ) |
03 | MouseLeave = script.Parent.MouseLeave |
06 | script.Parent.MouseEnter:connect( function (mouse) |
08 | target = workspace.CP 2. SpawnLocation |
09 | local camera = workspace.CurrentCamera |
10 | camera.CameraType = Enum.CameraType.Scriptable |
11 | camera.CameraSubject = target |
15 | camera.CoordinateFrame = CFrame.new(target.Position) |
16 | * CFrame.Angles( 0 , angle, 0 ) |
17 | * CFrame.new( 0 , 0 , 15 ) |
18 | angle = angle + math.rad( 0.6 ) |
24 | script.Parent.MouseButton 1 Down:connect( function (bloop) |
26 | game.Workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid |
27 | game.Workspace.CurrentCamera.CameraType = "Custom" |
28 | Torso.CFrame = CFrame.new(target.Position) |
29 | script.Parent.Parent.Parent:Destroy() |
Please let me know if this does not work, dont forget to leave a rep and mark my answer as correct if this is helpful, any tips on how to improve my answers are appreciated!