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

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

Asked by 9 years ago

I tried doing this:

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

the script is in StarterGui Any help would be appreciated

1 answer

Log in to vote
0
Answered by
BlackJPI 2658 Snack Break Moderation Voter Community Moderator
9 years ago

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
0
Thanx dude! NAWESOME14 40 — 9y
Ad

Answer this question