I have a animation system and would like to get the users mouse. Only problem is, I cant make the script a local script. This is what I have so far, but it wont work.

a script inserts a string value in each player with their name in the part. Then I used game.Players:FindFirstChild(''..StringValue.Value) to get the player. Now that I had played defined I did player:GetMouse() and it works in studio, just not online. I get a note online saying this "Workspace.(Player).script: attempt to index global 'mouse' (a nil value) "

name= script.Parent.Value
player = game.Players:FindFirstChild(""..namz.Value)
mouse = player:GetMouse()

EDIT: The errors on line 315, ill post that chunk.

mouse.KeyDown:connect(function(key)
    keysDown[key:lower()] = true
end)

mouse.KeyUp:connect(function(key)
    keysDown[key:lower()] = false
end)

4 comments

0

To access a value, for the player assignment try "game.Players[name]"

0

...Total derp moment. Thanks.

0

...It's actually giving me the same thing .-.

1

You quite simply can't get a player's mouse from a server-side script, and even if you could you shouldn't. You should handle client related things on the client, not the server. If you need to communicate between the client and the server use RemoteEvents/RemoteFunctions or value objects.