I'm creating is gun, and each bullet has its own individual script for hit detection and bullet physics and stuff like that. However, the problem is I'm trying to pass the data from the gun the player is holding to the bullet, that way I can tell the bullet to ignore the player when it comes to hitting detection. The problem is I don't want to use remote events, because I don't want a million remote events triggering if multiple people are firing the gun at once, cause that would create a lot of lag. And I don't know any other way to send information between scripts without remote events.
You could use ObjectValues for this, example: Main Tool Script:
local BulletScript = bullet:FindFirstChild("Script") local ObjValue = BulletScript:FindFirstChild("Player") ObjValue.Value = Player
local PlrValue = script:FindFirstChild("Player") local Player = PlrValue.Value function BulletHit(Object) if not Object:IsDescendantOf(Player) then print("Object is not the firing player's character, check if it's another player and damage") end end
Of course, this isn't a full script, just enough to give you an idea of how you can use ObjectValues in your code, Hope this helps Also, you could use ModuleScripts for this if the above doesn't help