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

How to get users mouse without Local script?[Solved]

Asked by 9 years ago

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)

0
To access a value, for the player assignment try "game.Players[name]" Redbullusa 1580 — 9y
0
...Total derp moment. Thanks. Orlando777 315 — 9y
0
...It's actually giving me the same thing .-. Orlando777 315 — 9y
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. DataStore 530 — 9y

Answer this question