"attempt to index local 'mouse' (a nil value)"?
Hi. A local script inside a tool fires a RemoteEvent also placed inside the tool when activated with the arguments of:
1 | firere:FireServer(mouse, hum, handle, damage, flyoffvals) |
The script that runs when RemoteEvent is fired looks like this:
01 | local firere = script.Parent:WaitForChild( "Fire" ) |
03 | firere.OnServerEvent:connect( function (player, mouse, hum, handle, damage, flyoffvals) |
05 | local fb = handle:Clone() |
06 | fb.Parent = game.Workspace |
08 | fb.CFrame = handle.CFrame |
10 | print (player.Name .. "'s fireball was launched!" ) |
12 | local particle = fb:WaitForChild( "ParticleEmitter" ) |
14 | particle.LockedToPart = false |
17 | local bv = Instance.new( "BodyVelocity" , fb) |
18 | bv.MaxForce = Vector 3. new( math.huge , math.huge , math.huge ) |
19 | bv.Velocity = mouse.Hit.lookVector * 350 |
21 | print (player.Name .. "'s fireball BodyVelocity was created!" ) |
23 | game.Debris:AddItem(fb, 1.5 ) |
25 | fb.Touched:connect( function (part) |
26 | local vhum = part.Parent:findFirstChild( "Humanoid" ) |
27 | if vhum and vhum.Health > 0 and vhum ~ = hum then |
28 | vhum:TakeDamage(damage) |
31 | local cfb = fb:Clone() |
32 | cfb.Parent = game.Workspace |
33 | cfb.Position = fb.Position |
34 | cfb.BodyVelocity.Velocity = Vector 3. new(flyoffvals [ math.random( 1 , #flyoffvals) ] , flyoffvals [ math.random( 1 , #flyoffvals) ] , flyoffvals [ math.random( 1 , #flyoffvals) ] ) |
35 | game.Debris:AddItem(cfb, 1.5 ) |
40 | elseif part.Anchored = = true and part.CanCollide = = true then |
42 | local cfb = fb:Clone() |
43 | cfb.CFrame = fb.CFrame |
44 | cfb.BodyVelocity.Velocity = Vector 3. new(flyoffvals [ math.random( 1 , #flyoffvals) ] , flyoffvals [ math.random( 1 , #flyoffvals) ] , flyoffvals [ math.random( 1 , #flyoffvals) ] ) |
45 | game.Debris:AddItem(cfb, 1.5 ) |
I'm getting the error at line 19. I'm getting the player's mouse using "player:GetMouse()" inside the local script. All help is appreciated very, very much. Thanks :} ~Loughdough