Item collection system based on server on client?

I’ve got a system, where you can chop a tree down, and it’ll drop wood. Problem I’m thinking of now is if this is better handled on the client (currently handled on the server)

Basically all the client does is when a player clicks, it creates a ray from the player to where they clicked (using whitelist for where I store the trees) and if the part they happened to click on is inside of the Trees folder then go to the server. Server then gets that item, sanity checks that it is actually inside the Tree folder and then takes away the trees durability (each tree has a NumberValue with its durability)

Problem with this however is when a player cuts down a tree, nobody else can. Trees regrow eventually, yes, but if all the trees have been cut a player may have to wait a while before they can get anymore progress made.So should I do the whole tree cutting on the client?

Problem I foresee with this idea, is the client can just:

  1. Set the durability in the tree to 0 instantly (no cutting needed) and thus not use their axe (tools have durability, so lose durability when they are used)
  2. When a trees cut, it drops 3 wood parts, that they can pick up. They could clone those, and thus collect a ton.

Probably more problems, but ye :confused:

So if anyone has any input, it’d be greatly appreciated :smiley:

1 Like

If you really wanted to store and calculate all the trees on the client side and prevent exploitation, you might have to calculate what trees there are on the server for each individual clients, and then send it to the client with trees that are created or destroyed. You’d then have to send back to the server if the tree is cut down, which then the server will have to check if the tree exists or not. To me, personally, I don’t see issues with having the trees loaded on the server and sharing the same trees across all clients, as players can interact with each other and the trees together, taking Lumber Tycoon as an example, all the trees are loaded on the server and shared across all clients

1 Like