iDertus7
(Ignosce)
October 26, 2024, 2:27pm
#1
Hello.
So i’m doing a script that clones a model from replicatedstorage.
The script that would clone the model is in server script service and the module script itself is inside the model.
this is the code that is supposed to clone the model:
local instance = game.ReplicatedStorage.Van:Clone()
local modulescript = instance:WaitForChild("ModuleScript")
instance.Parent = game.Workspace
local module = require(modulescript.vanmodule)
module.moveaway()
1 Like
What is not working in the script exactly, and r u sure that the modulescript is the vanmodule
one?
1 Like
iDertus7
(Ignosce)
October 26, 2024, 2:48pm
#3
So the error that it outputs has to do with the require.
It basically says that vanmodule (the table inside modulescript), is not a valid member of the module script itself
2 Likes
Skidouski
(caseoh)
October 26, 2024, 3:08pm
#4
Ignosce:
modulescript
can you test what this prints?
print(modulescript:GetDescendants())
2 Likes
iDertus7
(Ignosce)
October 26, 2024, 3:10pm
#5
It only prints an empty table {}.
I assume there is an error in the module script itself.
1 Like
You can’t require a table from the module, try this:
local instance = game.ReplicatedStorage.Van:Clone()
local modulescript = instance:WaitForChild("ModuleScript")
instance.Parent = game.Workspace
local module = require(modulescript) -- Corrected this
module.moveaway()
4 Likes
iDertus7
(Ignosce)
October 26, 2024, 3:35pm
#7
Alright, it seems to work now.
Yeah I’m new with module script usage. It wouldn’t make any sense to require a table, since it returns value anyways.
Thanks for the help, i’ll mark your solution.
2 Likes
system
(system)
Closed
November 9, 2024, 3:38pm
#8
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.