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

GetMouse() only works in studio?

Asked by 8 years ago

I'm trying to get a player's mouse with the ':GetMouse()' function, but it only works in studio (only after I do wait(1) before that). I even did a repeat function looking for a mouse and it still didnt work.

Code: game.Players.PlayerAdded:connect(function(player) local mouse = player:GetMouse() repeat wait(1) print('Searching for mouse...') until mouse print("Found mouse") end

This ONLY works in Studio, but in the server it doesn't (never prints found mouse, keeps printing searching for mouse over and over again).

How would I fix this?

Thanks!

1 answer

Log in to vote
2
Answered by 8 years ago

The mouse can only be used from a localscript PlayerMouse

I cannot suggest how to go about fixing this as I don't know how it is being used.

0
How would I use it from a server script? NewVoids 97 — 8y
0
All I need to do is figure out if a player pressed a button, so how would I do that from a serverscript? NewVoids 97 — 8y
0
mouse is client side so the server has no access, if you include some background info to what you are trying to do i may be able to suggest how to go about this problem. User#5423 17 — 8y
0
Okay, I just made it part of the client. Thanks! NewVoids 97 — 8y
Ad

Answer this question