Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

"attempt to index local 'mouse' (a nil value)"?

Asked by 7 years ago

Hi. A local script inside a tool fires a RemoteEvent also placed inside the tool when activated with the arguments of:

1firere:FireServer(mouse, hum, handle, damage, flyoffvals)

The script that runs when RemoteEvent is fired looks like this:

01local firere = script.Parent:WaitForChild("Fire")
02 
03firere.OnServerEvent:connect(function(player, mouse, hum, handle, damage, flyoffvals)
04 
05    local fb = handle:Clone()
06    fb.Parent = game.Workspace
07    fb.Name = "Fireball"
08    fb.CFrame = handle.CFrame
09 
10    print(player.Name .. "'s fireball was launched!")
11 
12    local particle = fb:WaitForChild("ParticleEmitter")
13 
14    particle.LockedToPart = false
15    particle.Rate = 300
View all 51 lines...

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

0
I don't see local mouse=game.Players.LocalPlayer:GetMouse() at the top of this script DanzLua 2879 — 7y
0
@DanzLua I said it was in the local script...? Loughdough 291 — 7y
0
@LoughDough its not in a localscript? DanzLua 2879 — 7y
1
That isn't the local script. Actually READ what I said. Someone already answered the question anyways so it doesn't matter. Loughdough 291 — 7y
0
@LoughDough don't be rude to someone who's trying to help you Sadwowow21 57 — 4y

1 answer

Log in to vote
1
Answered by 7 years ago

To the server mouse does not exist. Try just sending the lookVector instead of the mouse.

0
Thanks! Loughdough 291 — 7y
Ad

Answer this question