Players with high ping can place towers in each others. I use debounce to fix it but if I put too high values for pingDelay players feel bad delay before placing and upgrading towers.
Maybe someone knows other way how to fix it?
local debounce = -math.huge
local pingDelay = 0.5 -- Protection against 500 Ping
local function towerSpawn()
local timestamp = os.clock()
if timestamp > debounce then
debounce = timestamp + pingDelay
--Spawn tower
end
end
I assume you just need to make sure you check the position on server after the client verifies it. Ive never had issues like this doing the checks on server and client
you should have code somewhere that makes sure they are not close together right? Just make sure you aren’t able to place anything inside another tower on the server.
But there’s a issue with connection between client and server. If the ping is high, the server does not realize that the space is already occupied, so it allows you to place another tower. Cuz ping is a delay between client and server.
It should not be an issue on the server?? what does your code look like?? you should just have to send the remote then check the positions of other towers, and only checking the placement for one tower at a time…
ya, what @DamSam127 said should be the solution no? Just check if the space is free on the client, if it is fire it to the server and double check in the server whether the space is occupied or not