The title pretty much explains it all. The method im using is : Clinet - Fires a cast with a cosmetic bullet ( only visual) //// Server - Shoots another cast that does hit detection, using a remote event fired from the client.
The problem is : When two players are moving and one of them shoots, the shot misses 100% of the time, even if the client has visualized the shot clearly going through the players’s torso or other limb. I visualized the casts on the server and saw that they actually miss cuz of delay.
Is there a way to fix this without using client hit detection (can be exploited by changing bullet’s speed or damage)
An idea I have is to use the player’s ping in a loop and create a clone of the player’s bodyparts so if the shot hits those bodyparts, it will still damage the player since technically the cloned parts should be left a bit behind the player when they are moving so when the bullet hits them, it will still do damage.
I believe the only method of fixing this is to sacrifice hit detection security and hand it to the client to handle, then send the hit data to the server for validation
I recommend creating a background proccess on the server which does additional hit detections, if they fail, cache it and once a player gets x amount of failed detections they are kicked or whatever you want to do with them. Of course, it needs to be a cache that expires an entry after x time and a high enough punishment amount to prevent false positives as much as possible
Can you elaborate more on that? Also here’s how the method im trying rn is turning out. Do you think it can work? (It uses a loop with the wait time being the player’s ping) The gray part is an additional hitbox for the player.
I would still recommend giving hit-detection to the client, for performance and tick-rate related problems.
Roblox tickrate is somewhat low compared to games that use server-authorative lag comp solutions.
And even still with infinite tickrate it won’t be fully accurate, given the fact that roblox interpolates the client positions. We don’t know this interpolation value, so we can’t use it in the server-sided solution…
You’ll have to make a custom humanoid and such (chickynoid works, but again, tickrate).
Sanity checks if done effectively can stop exploiters on Roblox, look at Roblox’s FPS demo for a good example of client-sided hitreg and sanity checks.
I’ve tried looking at other fps frameworks but I can’t find anything. And for the sanity checks, its impossible to do (from what i know) since they can change the speed of the bullet inside the code and make it almost instant. This is my main problem.
You can also check the values for the bulletspeed, by encrypting it. Don’t even give any info about damage on the client. do damage on the FireServer once theres a hit on the client.
What you can also do instead of encrypting, is make some math formula once you fire the server, see if the bullet got there faster than it should’ve. Give it some leniency! Fastcast is based off math after all. What you can do is fire a fastcast on the server simply to check if the bullet got there faster than it should’ve, but this is probably bad, just use math.
On every shot’s start, fire to the server (you’ll need this for replicating VFX anyways). Then, log this as an os.clock (for full accuracy). For each players, have a table of two os.clocks. See if the difference between these shots lines up with the shots firerate, again give it some leniency. I don’t really recommend this though because pingspikes.
What you could do is have the player send their os.clock over, but they can change that, so just make sure that it lines up with sanity checks. No timetravellers here!
Encrypting the bulletspeed will work (what my game does), so will using a math formula. A somewhat crude way of doing it is firing a simpler projectile (SimpleCast? IDK), with no visuals, to prevent lag. See if it hits when it should
I only really recommend doing checks for bulletspeed, but I guess firerate checking should work. You can also have a server-client-server method for determining ping, see if that lines up with the firerate. Again, give it some leniency:
Example of server-client-server would be logging the current GetServerTimeNow(), firing the client (don’t send any data), and then having the client automatically fire the server. Don’t send any data. Now check the differential between the OnServerEvent and the :FireClient, that’s your ping.
What ruddevs battle royale does is they do an invokeclient wrapped in a pcall, and yeah that could work. Ruddevs battle royale is thankfully open sourced! InvokeClient is bad practice unless you secure the callback with a pcall and open a separate thread with a spawn(). This is a very niche case for an InvokeClient
There’s also a server-authoritative fastcast solution called “SecureCast”, but I still would go clientside since tickrate and fast-moving objects and such.
What you could do is actually doing the replication in the client after firing to the server
Fire to the server
Do fast cast on the server before the client
Fire to the client to do the replication
The server will always be ahead of the client here, and might give the effect you want, though of course they wont be in sync and the bullet might actually miss the player locally but hit on the server side
Nothing is more preferable than client hit-detection. On Roblox client-sided hitreg is your best choice if you want a competitive shooter. Just secure your data. The Roblox FPS template designed by programmers at Roblox use client-side hit detection.
Lag-compensation may not fully work on Roblox due to tick-rate and us not knowing the interpolation rate. You can use chickynoid to fix the interpolation rate problem but tick-rate could prove to be a problem. And AFAIK, chickynoid is not suitable for a large-scale game, instead you should use it in 5v5 shooters like CS or Valorant