i’m wondering about the performance of firing a remote event constantly to get something back. this is because of my implementation of full auto in a gun framework relies on constantly asking the client for the mouse location*, with the client sending back data with the location of the mouse inside.
is this solution necessarily performant in any regard?
local gunShooterStepper = runService.Stepped:Connect(function() -- in a variable just incase i need to do something funny e.g closing the event
if (not self.FiringHeld) or gunShotDebounce or self.CurrentAmmo <= 0 then
return
end
if self.GunHasFired and (not self.Properties.Properties.firemodes[self.GunFiremodeIndex]) then
return
end
gunShotDebounce = true
self.GunHasFired = true
clientInputEvent:FireClient(gunUser, {RequestingMousePosition = true})
--lastMouseLocationUpdated:Wait() this is VERY bad and caused some delays
local shotDirection = (self.LastMousePosition - gunProperties.Properties.firepoint.WorldPosition).Unit
self.CurrentAmmo -= 1
self.onFireBehavior()
gunCaster:Fire(rotateVectorInSpread(shotDirection, 0.8, 0.8))
task.wait(self.FireRateDelay)
gunShotDebounce = false
end)
i will have to go out of the house like very soon so i’ll be checking on any answers later in the day.
sorry for the bad formatting too. before i go out of the house i have an idea to just have the client send mouse location events to the server and have it handle holding down the mouse instead of the server, it might not be performant for the client but using a debounce set to the RPM of the gun i think it would work ok