Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Best way to make automatic FE guns?

Asked by 5 years ago

So my guns in my game work by firing an event every time the player clicks whilst said gun is equipped, I know how to make basic automatic guns by doing a while mouseButtonDown == true do and blah blah, but this would mean the shooting event would be looped continuously over and over (around 10 times in a second), I've pushed it to the limit by making the gun's rest time 0.02 and the network tranfer kb/s is sitting around 3kb/s a second, I know this is not where near the limit of 50kb/s, but I can imagine when there's 20 players shooting high fire rate guns at the same time could do something bad to the server.

2
You should only need to fire the RemoteEvent twice from the client side. The first time is when the player presses down on Mouse1 and the second time is when they let go of it. Have the server create the bullet and create raycasts using data provided by the client (Usually the mouse position). xPolarium 1388 — 5y
0
You don't need to follow the last sentence to my previous comment as that's a lazy way of replication. The rest is a basic way to go about client-server communication. xPolarium 1388 — 5y
0
Btw, I've noticed in your previous asked questions you worry about the 50kb/s limit. You shouldn't need to worry about performance loss when you're new to scripting. Get a working build first then sort out the performance issues later. You'll get stuff done and actually develop your scripting skills. Don't let perfection throw you off from improving. xPolarium 1388 — 5y
0
Awh thank you! Marmalados 193 — 5y
View all comments (2 more)
0
I thought about doing that, but how would the server know where the player is pointing unless a new event is fired transferring the mouse position data? Marmalados 193 — 5y
0
Transfer the mouse.Hit.p (a Vector3) through the first remoteevent that also lets the server know they've clicked the Mouse1 button. xPolarium 1388 — 5y

Answer this question