I am making a weapon system and I plan to do everything through a local script and 1 server script for each player, so far so good, but I was wondering what is better? for a machine gun weapon? to send a remote event through a while loop and send the mouse position each remote event or send a single remote event without the mouse position and the server does the while loop but: How do I know where the player is pointing from the server?
You need to use RemoteEvents, and preferably when the user is actually trying to shoot. For a machinegun weapon you have issues with throttling, but one workaround is to send fewer events and the server executes a burst of shots, while the client shoots accurately for lag compensation. It does mean there will be cases where the server will over-shoot, but if that’s just for effects there’s no problem.
I know what you mean- it’s a difficult challenge that even professional game companies spend a lot of money trying to solve.
Easy answer, cast rays on the client, tell the server what you hit
Someone with a different idea or explain to me what part of the faith gun kits I should do or what, honestly I see people who make complete codes for beginners, and I only ask for guidance for this but no one supports me, what happens?
You either need to place a lot of trust in the client, which may be okay depending on what type of game you are making, or you need to fire a remote whenever the client wants to fire a shot.
hey I ask you what is more optimized: throw parts with linear velocity and that work with touched event, or ray cast, but I don’t know the user @weakroblox35 left me with doubts if using ray cast in a machine gun weapon is good or it is very poorly optimized
Raycasting is very performant, you can do tens of raycasts every second and have no issues. raycasting is also way more predictable and stable than physics-based projectiles, if you want gravity to affect your projectiles or other factors, then look at FastCast