Hello devs! today I started learning on how module scripts work, and even though I already have the jist of how they work, I dont know if what im doing is how they should be used
For context im trying to make a simple FPS script
local module = {}
module.TestAnim = nil
module.AnimTrack = Animator:LoadAnimation(TestAnim)
module:MouseClick()
--gun go pew
AnimTrack:Play()
end
return module
Now obviously this code when required will error, but how else would you reference the humanoids animator? Should I even be using variables in module scripts to reference things the say way I do in normal scripts?
First of all, where are you going to place this module? If it’s going to run on the client, you can just do game.Players.LocalPlayer to reference the player object. If it’s on the server, you can create a function inside the module and pass the player when you call it from a script
Modules are just a way of having your code more organized and easy to edit but you can still make local variables in them