player = script.Parent.Parent mouse = player:GetMouse() PartsLeft = game.Workspace.PartsLeft function colorChange() if mouse.Target ~= nil then PartsLeft.Value = PartsLeft.Value + 1 end end mouse.Button1Down:connect(colorChange)
I put this script in StarterGUI so that the player will be identified more easily. The thing is that when I play in "Solo Mode" it works just fine but when I go into "Start Server with 2 people" the output error says that Attempt to index global "mouse"
. What is wrong with this script? How come the players in the server can not do the same thing as in "Solo Mode".
I also tried to put the script into Workspace, and identify player as game.Players:getChildren()
but it did not work.
The PlayerMouse is only accessible from a LocalScript, not a regular script (so the Workspace solution couldn't work anyway)