I currently have a thing that fires a remote event every wait() for about 3 seconds. It works fine for now but I’m just wondering if it’s really that safe.
I’m just sending a string and a humanoid through FireServer
( so it would just be RemoteEvent:FireServer(“String”, Humanoid) )
I’m actually firing it every wait() (or about .03 seconds I think)
I’m firing a bunch of mini projectiles for a flamethrower and I have the client set as the network owner so I’m using the remote event to do damage when one of the projectiles hit a character, hence the humanoid I’m passing as an argument.
–
self.Duration is 3
local Duration = 0
while (Duration<self.Duration) do
Do() -- This launches a projectile and all that
Duration = Duration + wait()
end
Why don’t you just fire the event when they start and stop firing and then determine who is in the path of the fire on the server? Trusting the client 100% will lead to vulnerabilities, and needlessly sending data that can be assumed, especially at such a high rate, is a really bad idea in general.
Okay I think I’ve found a better idea, since the projectiles are made on the server I just use the touched event on the server as well. I think it works great
If you are using the Touched event for Hitboxes, do not do that at all. The Touched event is not precise when it comes to hit detection. If a player wants to make a moving Projectile, do not use raycast. I would recommend using Region3, on the Client make a Region3 for the Projectile created, if the Region3 hits something fire an event to the server, create a region3 on the server and check if that hits something (this is a sanity check), if it does then follow up with your code whether it might be damaging a humanoid or something else. Also another thing to note is that if you’re firing your projectile in different angles and you’re using Region3, you want to use RotatedRegion3 instead because it implies a simulated version of a Region3 being rotated since Region3s cannot be rotated.