I need when he equip the tool and press right click it switch camera view but its not working...the local script is in the tool itself
Whats is happening?
https://gyazo.com/b2f4697893d416f5ba97110afb03a8d3
01 | local Tool = script.Parent |
02 | local camera = workspace.CurrentCamera -- the current camera view |
03 | local aim = script.Parent.AimCameraView -- the part I want the camera view to go to |
04 | local cameraview = workspace.CameraView -- the camera in the workspace |
05 |
06 | Tool.Equipped:connect( function (Mouse) |
07 | Mouse.Button 2 Down:connect( function () |
08 |
09 | cameraview.CameraType = Enum.CameraType.Custom |
10 | cameraview.CFrame = aim.CFrame |
11 |
12 | if camera.CFrame = = aim.CFrame then |
13 | print ( "The Camera is in the aim view" ) |
14 | end |
15 |
16 | end ) |
17 | end ) |
Your setting the CFrame instead of the CameraSubject and you are also using the wrong camera try this code instead.
01 | local Tool = script.Parent |
02 | local camera = workspace.CurrentCamera -- the current camera view |
03 | local aim = script.Parent.AimCameraView -- the part I want the camera view to go to |
04 |
05 | Tool.Equipped:connect( function (Mouse) |
06 | Mouse.Button 2 Down:connect( function () |
07 | camera.CameraType = Enum.CameraType.Custom |
08 | camera.CameraSubject = aim |
09 | if camera.CameraSubject = = aim then |
10 | print ( "The Camera is in the aim view" ) |
11 | end |
12 | end ) |
13 | end ) |