I made a modulescript inside of replicated storage to pass a function to another script
Heres the issue
Heres the code that i use
-- module script
local module = {}
function module.PlayFireSound()
print("ModuleScript Worked")
end
return module
-- server script
local mod = require(Tool.RecoilAnim)
mod.PlayFireSound()
The module script works when i pick up the gun instead of when i fire it.
SORRY FOR VERY BAD VID QUALITY THE VIDEO WAS TOO LONG SO I NEEDED TO USE 480P
When you pick up a gun, I assume it clones a gun into the players Backpack. The script within the gun then runs, which starts the sound to play.
I think rather than have the server script just play the sound on creation, I would make the script listen for when the player clicks, or whatever the player has to do to shoot the gun, and only run the code that plays the sound when that event fires.
Detect clicks with a local script, then fire the server using a RemoteEvent, which plays the sound when the event is fired.