What sanity checks for projectiles?

I have made a projectile system and I want to know what sanity checks I should do on the server.

My set up: ↓

  1. Client-1 asks server to shoot their gun.

  2. Server does sanity checks.

  3. If all ok then the server tells all other clients to create a bullet from client-1’s gun.

So my sanity checks will be going in number 2 where the server is the bridge between client-1 and all other clients.

Any help appreciated!

Anyone know what kind of checks?

Could you explain a bit more on how it works? Does the client send the hit target or does the server perform the projectile hitbox?

So, everything is done on stage 3, the creation of the projectile and all that is done at stage 3, the first stage is simply the client telling the server “hey I want to shoot a bullet”, the second stage is where I want to put some sanity checks to see if the player is allowed to shoot.

I just need some ideas of what to check for.

My ideas would be something like this:

  1. Implement a server-sided debounce via attributes on the character/weapon, depends on the way your game is
if character:GetAttribute("ShootDebounce") then
	return
end

character:SetAttribute("ShootDebounce", true)

-- // do the projectile logic

task.delay(0.1, character.SetAttribute, character, "ShootDebounce")
  1. If there is a limited amount of ammo, implement the check on the server to prevent exploiters firing projectiles without any limits
-- Let's say the character has an attribute "Bullets" and it's set to 30
local bullets = character:GetAttribute("Bullets")
if bullets <= 0 then
	return
end

character:SetAttribute("Bullets", bullets - 1)
1 Like