Invoking the Client

Hello developers!
Hope you all having a great day. I just had a really big problem with the invocation of clients through the server. Here is my problem:

I have a CharacterService. This handles everything for the Character. When executing the move, I want to sometimes request or yield the main thread on the server until all the effects or else is done on the specific user. How can I achieve this with the maximum exploitation patched? My flow of data is like this: (Example)
Server needs mouse data → Client gives mouse data while server waits → Server proceeds with the main thread.
Trust me, I have looked all over the forums and my answer really hasn’t been found.

Is there something I can do to maybe change the flow up?

Well, I’d just use two remote events (one to fire at client, one to listen for response) and then do a wait loop that halts the function until either a response is obtained or if too much time passes (to prevent infinite waiting).

1 Like

I use that, without the timer. What if I just used the RF but instead I wrap in pcall?

Also a bigger problem, how can I “undo” the move if the player resets or leaves. I don’t want to leave the enemy player hanging like that with them being like anchored to the position. Is there any easy way or I just have to manually code all the outcomes? The invocations will destroy the call procedure and leave other clients hanging.

I would suggest using a RemoteFunction – from client, invoke the server and if it happens to be something you wish to yield for, execute certain code, if not, have it instantly return to continue whatever it may be you’re doing.

RemoteFunctions yield for results, RemoteEvents continue even after fired.

1 Like

PCall could work just as well, but I think it could result in a messy structure if you need to use it frequently in a function. Might end up with a lot of Indents.

For “Undo”, that kind of depends on what that means. I usually have certain things like stun or grabs on seperate threads that end automatically if it’s not called again, that way if something goes wrong it won’t result in a softlock.

1 Like

you could do everything on the client and when the move would need to do damage or anything that should be handled by the server you could fire a remote to the server and let the server validate the move made by the client

*edit

what I believe your system is currently doing is it has a move that has hitboxes, vfx, and sfx, linked to some sort of timer or animation

so moving everything (including the hitboxes) to the client linked to that animation or timer would solve your issue i think? the only problem would be that validating the hitboxes on the server would be really annoying

1 Like

What if its a cutscene and I need the client to finish its camera or etc.

Basically it would be the same thing everything is linked to the client and when a hitbox is required you just fire the server and validate it there

validate if the cutscene move can be used?
validate if the distance between the players is reasonable?
etc

1 Like

No no I want the cutscene to play out but I want the client effects done first and then I can issue the hitboxes on time. Thats the reason for such invocations…

the hitboxes and fx can be done at the same time if they are both in done on the client

lets say there is a hit in a cutscene that you want to apply fx and the hitbox to. you could allow the client to handle both of them

-- hit in the cutscene is reached

--[[
    this is done both on the client    

    play the fx
    connect the hitbox
]]

i feel like handling the hitboxes and the client fx seperately makes it really complicated and there would be a lot of desync due to the latency between the client and the server. but doing it both on the client and letting the server be a bouncer of some sort takes that problem away i think (unless im misunderstanding again)

1 Like

But thats just a security breach basically. You want to minimize the things client can do which can be game breaking. The hitbox can be manipulated so easily like size position cframe etc.

Also back to the redoing thingy I asked,
Thanks I will have to implement a StunService. I already placed a DamageSystem :grin:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.