Server -> client -> server communication

to explain,

  • 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?

3 Likes

Signals don’t collide with each other

3 Likes

suuuuuuuuper useful and definitely answers my question(sarcasm)

1 Like

Signals still don’t collide with each other

3 Likes

RemoteFunctions.

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
3 Likes

Wouldnt using a remote function work? they should not collide with each other if the parts are sending a seperate remote function.

3 Likes

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.

1 Like

This is a possible solution, but it is very risky.

3 Likes

yes i remember watching a video about this and it also provides a alternative

2 Likes

Just wrap it around coroutine and add exhaustion time

2 Likes

Pcall

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
1 Like

why would you initially need to send a signal to the client?

just have part1 and part2, listen to the clicked events on the client, then just send a remote event with what the client clicked

also you shouldn’t send mouse objects over remotes

3 Likes

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

2 Likes

i should’ve specified but the client is sending the mouse’s 3d position

then you’ll need to send the Mouse.Hit.Position to the server, not the mouse object itself

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.

1 Like