Currently I am working on a collectble system where I am checking the distance between the player’s character and every collectable in a certain region he’s in. If the player is close enough, an event is fired to the server where safe checks are made and if all conditions meet I make the collectable disappear.
Is it ok that I make the collectable disappear through the server or can it be slow?
Also, I’d appreciate it if someone can verify whether the information in my previous post is good.
Your system will work perfectly fine. However, there might be a little visual latency between the player walking to the item, and the item disappearing and appearing in their inventory. This isn’t gamebreaking or anything, but it does makes the user experience a tad annoying.
Ideally what you want to do is to perform your checks on both the client and server. When the player goes near the item, you should instantly hide the item on the client (by setting transparency or parent or whatever). That way, by the time the server deletes the item and it replicates back to the client, the item will have already disappeared to the client.
What I did is I also hid it on the client but something weird I noticed is that some server changes do not always replicate to the client.
An example would be changing transparency. Let’s say you have a part with Transparency 0 on both client and server. Then, on the client, you change it to 0.5. If some time later you try to change the transparency to 0 on the server, it won’t replicate to the client since the transparency is already 0 on the server. It’s like it ignores that line of code if the change is already present.
So basically the issue is that, if I hide it on the client and then conditions do not meet and I have to make it visible again it won’t replicate since it’s already visible on the server. However, I am sure I can work something out.