player = game.Players:GetChildren()
for i = 1, #player do
if player[i] ~= nil then
mouse = player:GetMouse()
PartsLeft = workspace.PartsLeft
function addToParts()
if mouse.Target == script.Parent then
PartsLeft.Value = PartsLeft.Value + 1
end
end
end
end
mouse.Button1Down:connect(addToParts)
Whenever I go into the game and press on this part, it does not add to the PartsLeft Value. It says Attempt to index call method "GetMouse" (a nil value). Did I not add something?

1 comment
Make sure you're using a localscript, the GetMouse method doesn't work with a server side script.