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 10 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...

local mod = retrieve(game.Workspace.M1911)

function OnKeyDown(key)
    if key == "r" then
        mod.reload()
    elseif key == "f" then
        mod.melee()
    end
end

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 10 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:

local 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 — 10y
Ad

Answer this question