So im making a gun and to avoid exploit, I've been told to do sanity checks and one of which is to check on the server if the player can actually see what they are hitting? I have no idea where to start but I believe there is something to check if a part is in the view of the player.

8 comments

0

I think having the client tell the server the distance between what is hit and the player that shot is enough. Then the server can compare if it was possible. Viewport is what you are asking for though.

0

put a script in the localplayer

0

But what if they are in distance, but the exploiting player fires an event to kill someone behind a wall?

0

You shouldn't have an event that tells the server to kill someone. Just pass the data, like the distance between target player and the shooter, to the server using a RemoteEvent. Don't give power to the client for things like that and you'll be fine.

0

I've been told to use distance before, but i dont necessarily know how to, lets say "Event:FireServer(distance)"?

0

Distance would be the magnitude of both Vector3 positions. See it on RobloxDev wiki.

1

just don't

0

And how would distance be used in this? I’m not very well equipped in this but I try