How could I handle multiple tools with one LocalScript?

I am making a simulator styled game and I have multiple tools with a LocalScript inside each tool. Is there a better way to do this? I definitely know that ModuleScripts are involved but I am a little confused on how to use it: example I want each tool to give different points to the player.

You could manage the points givers inside the module( preferred under a script in service script service),

Use a remote event from the local script, provide the tool name or something unique for each tool,
On the server( script that has the module as its child) call the event and seach for that tool/key inside the module.
(In the module have a dictionary of keys that represent the tools/keys you’d send from the remote)

And for each key assign a value that would represent the amount of points to be given.

Example:

local module = {
    ["Tool1"] = 10,--ToolName, Amount of Points
    ["Tool2"] = 25,
}

return module

In the remote of the local scripts inside the tools:

--Variables here..
Remote:FireServer(Tool.Name)

And then on the server check if that tool nane exists in that module dictionary and if so, award the players with the amount.

The reason for storing the module here in the server is to prevent exploiters from accessing it.

If you’d need to use that module on client, you might want to put it in replicated storage( exploiters can access it easily from there).

2 Likes

Hello. Thanks for your reply.

How should I write the checks on the server?