Sometimes when you have a remote which transfers something to another thing (like buying since it transfers the money to something/someone else/nowhere and transfers an item from nowhere to you, grabbing objects from the floor, etc) , especially when it's something like taking something off something (two players can have the same idea and both try to pick it up), if they're fired and the server receives them at the right time, it duplicates. To explain this, I'll use the code below.

--client
local function grab(object)


	remote:FireServer(object)
end
--server
local playerObjects = {}
function grabObject(plr, object)


	if object.Parent then


	

	object.Parent = nil


	

	table.insert(playerObjects[plr], object)


	end
end
remote.OnServerEvent:Connect(grabObject)

This seems all good, but it actually isn't. Lets say that two people grab the same object at the right time.

--thread1
function grabObject(plr, object)


	if object.Parent then


>	

	object.Parent = nil


	

	table.insert(playerObjects[plr], object)


	end
end
--thread2
function grabObject(plr, object)


	if object.Parent then


>	

	object.Parent = nil


	

	table.insert(playerObjects[plr], object)


	end
end

(the > is what's going to be ran next)

Do you notice the problem? Both threads passed the check, even though it's the same object. When buying an object, this can still happen with the above code when replacing the if to check their cash and replacing the part setting the parent with you subtracting their money. Although this is unlikely to happen, if timed right, it may happen and now both players have the same object. To fix this, we can handle the object grabbing in one thread, like by doing the below.

while true do


	

local plr, object = remote.OnServerEvent:Wait()


	if object.Parent then


	

	object.Parent = nil


	

	table.insert(playerObjects[plr], object)


	end
end

Now, even if the remote is called by two different people and the server receives the calls at the same time (on the Lua side since in the picture here I'm pretty sure that the network part includes remote requests and if both come between one frame's network part and the next, on the Lua side it would be processed at the same time or appear to run at the same time) only one of the requests will be processed at a time.