server
-has 2 clickable part1 and part2
-of either were clicked,
-send a signal to client
client
-received the signal from the server
-click on otherpart(is not a clickable part)
-get the mouse’s 3d position
-send mouse 3d position and otherpart to the server
server
-received mouse 3d position and otherpart from client
-does stuff with mouse 3d position and otherpart which depends on whether the client clicked on part1 or part2
how would i do this without having signals colliding with each other?
I cant open studio right now because it makes updates but it would look like this:
On server:
local myRemoteFunction = ...;
function blabla()
local response = myRemoteFunction:InvokeClient(Player)
repeat wait() until response
print(response) --Prints hello world
end
On client:
local myRemoteFunction = ...;
function onInvoke()
return "Hello World"
end
myRemoteFunction.OnClientInvoke = onInvoke
I’m not entirely certain what it is you want exactly. But basically use remote events or remote functions to send the minimum amount of data across the client/server boundary. Like have it pass a 1 or a 2 so the server and client can know what the other one did. Also you mentioned sending the mouse across which might just be a misunderstanding, but the mouse is a client only object and can’t be passed to the server. You can however pass the information you need from the mouse across at whatever speed you need.
I tried around a bit in studio, and idk why, but even if the client dosnt return anything it still prints that it passed, but with a nil response, so you have to check if the response is nil or not.
local success,response = pcall(remote.InvokeClient,remote,Client)
if success == false then print("return") return else print("passed",success,response) end
I’m pretty sure Click detector can be done in server side, also passing down an argument with which player it is pressing. If that is what you wanted to achieve ClickDetector | Documentation - Roblox Creator Hub
When using RemoteFunctions, always be sure to have a timeout and maximum on-going requests per session as exploiters interrupt the proper return response or for any players with connection issues.