Hello! I'm having troubles with output, it's saying I have a nil value when it is clearly stated
Hey guys, so I am trying to get it so that if the mouse targets a frame, the camera view changes to fit the left or right place, so it gives you a "Look around" can anyone see why it gives me this?: 22:01:12.063 - Workspace.Player1.Helicopterseeing:21: attempt to index local 'mousetarget' (a nil value)
here is the script:
01 | local camera = game.Workspace.CurrentCamera |
02 | local target = game.Workspace.Heli.Heli 1 |
03 | local target 2 = game.Workspace.Heli.Heli 2 |
04 | camera.CameraType = "Scriptable" |
05 | camera.CameraSubject = target 2 |
06 | camera.CoordinateFrame = CFrame.new(target 2. Position) |
07 | * CFrame.Angles( 0 , math.rad( 90 ), 0 ) |
09 | game.Players.LocalPlayer.PlayerGui.TalkGui.script 1. Disabled = false |
11 | if script.Heli 3 Ready.Value = = true then |
12 | camera.CameraSubject = target |
13 | camera.CoordinateFrame = CFrame.new(target.Position) |
14 | * CFrame.Angles( 0 , math.rad( 180 ), 0 ) |
16 | local player = game.Players.LocalPlayer |
17 | local mouse = player:GetMouse() |
18 | mouse.Move:connect( function () |
19 | local mousetarget = mouse.Target |
20 | if not modelMode then return |
21 | elseif mousetarget:IsA( "Frame" ) and mousetarget.Name = = "Left" then |
22 | camera.CoordinateFrame = CFrame.new(target.Position) |
23 | * CFrame.Angles( 0 , math.rad(- 10 ), 0 ) |
25 | elseif mousetarget:IsA( "Frame" ) and mousetarget.Name = = "Right" then |
26 | camera.CoordinateFrame = CFrame.new(target.Position) |
27 | * CFrame.Angles( 0 , math.rad(- 10 ), 0 ) |