Script / ModuleScript that stock objects path

  1. What do you want to achieve?
    Hello, is it possible to make a modulescript or script where i can put my events like that :
    [“Event1”] = game.ReplicatedStorage.Event1
    [“Event2”] = game.ReplicatedStorage.Event2

  2. What is the issue?
    I don’t know how to do it.

  3. What solutions have you tried so far?
    I tried myself.

Sure, you can do it. You already did do it.

return {
    ["index"] = object_path
}

Something else you’re looking to do?

1 Like

Thank you, yes how can i use the path in a script ?

When you require the module that stores these objects assuming that format above, you will get back the table. You need to access whatever index you gave to the object and it’ll return a reference to that object. So rather than using the path, you’re using the index where the object lives in said table.

-- Your ModuleScript
return {["foobar"] = object_path}

-- Your script, let's assume object_path is a RemoteEvent
require(ModuleScript).foobar:FireServer()
1 Like

Okay, thank you for helping me !