How to make a projectile client side detection

Hey guys! I am here to ask if anybody reading this have any idea on how to make a projectile client side hit detection . I would like the hit detection to be handled on the client but I have no idea how to do it . My idea is to fire a remote event which tells the server the origin and direction to tell the other clients for visual effect .
But I soon found a problem which is when the client get a positives hit, do i just send the origin and direction to the server ?How would the server know that the origin had not been tempered with due to the time taken for the player to fire?

any suggestions? Thanks in advance :>

3 Likes

May I ask why you are handlign this on the client? remote events are easily usable by exploiters to send false data

1 Like

most games use client side hit detection like arsenal. client side hit detection is the most accurate even tho less secure

2 Likes

so are you using it for .touched or for the mouse.hit.p?

1 Like

I am using “simulated physics” where i anchored a bullet and raycast infront of it every frame

1 Like

Try using workspace:GetPartsInPart

I’m not 100% sure if this works client sided but I’d try it

1 Like

use fastcast, it handles all the annoying projectile math for you

yea but i like it custom as I can easily change it and understand

https://etithespir.it/FastCastAPIDocs/

id say the api is pretty intuitive
and you can always pop the hood and look under some of the source code to change it urself

you can easily edit fastcast. it has functions to update the movement of the projectile

fastcast doesnt have a part for the projectile, its just a set of raycasts that a part without collision is connected to

Is fast cast server side or client side??? I am kinda confuse with fast cast now . Thanks for the reply

you pick server or client (you should never have projectiles on the server anyway due to lag), read the page i sent you. it tells you how to set it up

if you have more questions they have an api docs

1 Like

wait but if validate the hit on the client , how do i ensure that the hit is valid??? or do i just dont :clown_face:

you have to do checks of your own on the server

every gun system does hit detection on the client which then fires a remote to the server with the hit data. then the server will validate that request using various methods

most common methods are

  • if you have a settings file: make sure its a valid one
  • do magnitude checks seeing if that shot was even possible

do not raycast to check if they shot through a wall. this only works if your bullet has no gravity. if it has gravity then you wont be able to do wall checks

Wdym by setting file? Is it like a module script with the settings? Also the magnitude check is kinda useless as hackers can just shoot through walls by using a RemoteEvent . Thanks for the reply!

i dont have time to explain in a lot of detail about other sanity checks

but about the settings file i meant gun settings. storing the damage of the gun and stuff

1 Like