Ownership question

I’m wondering in a tycoon style game where the players have ownership over their own base how to implement an external ownership system. Say there is an object that any player can claim and I want to make sure that the player selecting the object gains ownership over it. This is pretty straight forward but I’m wondering what to do in the event that two or more players try to take ownership of the same item in the same tick() cycle. I thought about issuing a randomseed based on os.time() but then both players would still have the same seed.

Is there another way to do this?

RemoteEvents fired by clients are handled sequentially by default. The first event that claims ownership can set a variable/attribute to lock in an owner and following events can immediately cancel when they see the owner is already set.

You mention a cycle that your game relies on that might process multiple ownership events at the same moment. Could you elaborate?

I was thinking about checking ownership status of the object before continuing, the cycle I mean is that of the function that handles it (is there another word I should use) from function to point in the inside the function where it assigns ownership. Roblox runs on tick() and there is that so small chance that two people could start the process before ownership is assigned.

This is mostly not a concern but it might be based on how you handle this “process”. If you set the owner before any deferring or yielding of execution, then following events received on the same frame will recognize the change of ownership from the first event. If it’s deferred/yielded, then this race behavior becomes relevant.