Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
2

Retrieving Multiple Module Scripts?

Asked by 11 years ago

So I've been trying to think of a new way to make an equip script for guns without a tool. I think if I use a module and bind the keys in a local script outside multiple modules, I should be able to make a weapon system that is very versatile.

LocalScript-->Resources-->RetrieveModule(name)-->Bind keys to Module functions...

like an example might be...

1local mod = retrieve(game.Workspace.M1911)
2 
3function OnKeyDown(key)
4    if key == "r" then
5        mod.reload()
6    elseif key == "f" then
7        mod.melee()
8    end
9end

mod itself could be changed to different types of guns. Resources would be local of course. Any thoughts about my idea? Do you guys think it is plausible? I thought this is up but I don't want to spend the time scripting if it doesn't work.

1 answer

Log in to vote
1
Answered by 11 years ago

I'd say this is very neat and possible idea. All you'd need for that to work, is the gun model, so I guess you could do it like:

1local mod = require(game.Workspace.M1911Module)(gunModel)

So you'd have to make so the module returns a function, that takes the gunModel and initalizes the system and at the end returns table with actions.

0
Yes exactly. Thank you for the input. I really wanted a second person's opinion! soaprocks2 75 — 11y
Ad

Answer this question