Answered by
7 years ago Edited 7 years ago
I'll show you how i did it
Server
1 | local GetMouse = replicatedStorage:WaitForChild( "GetMouse" ) |
2 | local mouse = GetMouse:InvokeClient(player) |
4 | mouse = GetMouse:InvokeClient(player, folder) |
Client
01 | local players = game:GetService( "Players" ) |
02 | local ReplicatedStorage = game:GetService( "ReplicatedStorage" ) |
03 | local player = players.LocalPlayer |
04 | local mouse = player:GetMouse() |
07 | local GetMouseRequest = ReplicatedStorage:WaitForChild( "GetMouse" ) |
09 | local function onGetMouseRequested(folder) |
10 | mouse.TargetFilter = folder |
14 | GetMouseRequest.OnClientInvoke = onGetMouseRequested |
I use this method only when I need to constantly update the position of the mouse, the easiest way to do it without updating the mouse is really simple
Wherever you're firing your Remote Function
1 | local Event = replicatedStorage:WaitForChild( "Event" ) |
3 | local function onMouseDown() |
4 | Event:FireServer(mouse.hit) |
And in case you don't know how to get the mouse.hit from that you can do
1 | local Event = replicatedStorage:WaitForChild( "Event" ) |
3 | local function onEventFired(player , mouse) |
This sends the mouses position from client to server once and doesn't update the position, so good only if you need it once
Hopefully you'll be able to figure this all out