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

How to get the player's mouse in a global script?

I tried doing this:

player=script.Parent.Parent.Parent  
mouse=player:GetMouse() 

the script is in StarterGui Any help would be appreciated

1 answer

✓ Accepted answer

Although I'm not sure why you want this in a server script, the only way I know how to do it is with RemoteFunctions.

Scripts

Server Script:

local GetMouse = Instance.new("RemoteFunction")
GetMouse.Name = "GetMouse"
GetMouse.Parent = game.ReplicatedStorage

local player = script.Parent.Parent.Parent 
local mouse = GetMouse:InvokeClient(player)

Local Script:

game.ReplicatedStorage.GetMouse.OnClientInvoke()
	return game.Players.LocalPlayer:GetMouse()
end

1 comment

0

Thanx dude!

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