Best way to handle client only objects?

Hello world :slight_smile:

Tl;dr.
How do I handle client side scripts for 100s of items only seen by the client, and stop exploiters from picking up things they shouldnt be able to, like keys, since the client tells the server it was picked up.

I want each player to solve a puzzle to get to the end, so they must find items and push things and what have you, in order to do so.
This means that player 1 would have to find a key, and so would player 2. But I’d like the item to be removed afterwards. This wouldnt be done easily with a server script (unless you got some ideas)
But if the player messes up and they need to reset, the items need to be put back in their place… I hope this makes sense… lol. I have this much worked out.

I’m using 1 script per item, stored in the players character, referencing the items to make things work client side.

What’s the best way to handle this? I dont want exploiters to just give players keys by hacking into the local scripts and hijacking the remote used to tell the server the player has picked up a key, which adds to the total keys count. As opposed to a server script that would just communicate with the server and add to the keys. Cause it’s up to the players to decide what door to use the keys on… and maybe it’s the wrong door :wink:

What have I tried? Well. That’s why I am here lol. I have no clue how to get around this since exploiters can easily see the client side scripts. I tried making the key server side, but then I cant remove it on the client side when its picked up or its lost forever. I tried moving it on the client side with CFrame but It always stayed where it was…

Any brains gots the solution? Or suggestions?

Thanks for reading!

If the players are picking up the keys using a .Touched event then you should do that on the server and only make it transparent/deleted on the client using a remote event or a separate local .Touched event.

You can save a table on the server of who has already picked up the key so they can’t pick it up more than once by checking if they are already in the table or not.

This way there is no reliance on the client to send when they pick it up, so it won’t be possible for someone to get a key through exploits so long as you are checking if they have the key on the server when they attempt to “use” the key.

2 Likes

But if I delete it using a server script / remote. It’s gone. When a player resets their character, it wouldnt replicate.

I see what you’re getting at using a table to store what players have picked up the key, and maybe in combination with a local transparency modifier it could work. That lead me into the right direction. I already started in that direction earlier and I cant remember what stopped my progress but this seems promising. I’m usually a lot less noob. I guess I’m just confusing myself right now. Lol

Thank you :slight_smile:

As I said, use a remote event or local .Touched event to remove/transparent the key. (Use a remote event from the server to tell the player’s client to delete/transparent the key).

1 Like

Just wanted to say thanks for pointing me in the right direction. Your solution was perfect. I guess I was just overthinking things as I usually do…

Thanks bro :slight_smile:

2 Likes