Remote event or while true do?

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?

pleaseeeeee

6 Likes

don’t be lazy to ask… that’s why we were born!!! to ask what we don’t know (if you don’t understand something).

3 Likes

I know it is not necessary to emphasize but I have already done some research on the subject.

2 Likes

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.

3 Likes

I am not talking about effects, I am talking about ray
I just want to know that you don’t understand so I can explain

2 Likes

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

2 Likes

waiting for a helpful answer pleaseee

1 Like

1 Like

Use InputBegan.

1 Like

YES I KNOW, the problem is how do I know where the player is pointing from the server

1 Like

You can’t, you need to pass it as an argument.

1 Like

won’t it be poorly optimized? ddddddd

1 Like

No that’s how every other game does it. (Unless you’re using raycast)

1 Like

I use ray cast, what would I do in that case?

1 Like

Hey, please answer me. My question is that I don’t know what you mean by at least using ray cast, like the other games do?

1 Like

just look at what FE GUN KIT does.

1 Like

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?

1 Like

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.

1 Like

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

1 Like

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

1 Like