Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

GetMouse() only works in studio?

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

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.

4 comments

0

How would I use it from a server script?

0

All I need to do is figure out if a player pressed a button, so how would I do that from a serverscript?

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.

0

Okay, I just made it part of the client. Thanks!

This discussion is preserved as it was. New answers, comments, and votes are closed.