Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

I need help. Why didn't this work? Problem with Parents,Childs

Code:

local eai = require(game.ServerScriptService.Modulez.Classes.Enemy.EnemyAI)

Output:

15:03:44.987 - Modulez is not a valid member of ServerScriptService

Modulez is a member of ServerScriptService

3 answers

✓ Accepted answer

There could be several solutions..

SOLUTION 1:

It might be that you are trying to access game.ServerScriptService via a Local Script, also called 'client side'. The ServerScriptService is only accessable with server-sided scripts, so you would have to switch over to a normal script, called 'script'.

SOLUTION 2:

Another solution is that you are requiring the module before it even exists. This is most likely the case if you are using normal scripts. A simple and clean solution would be adding WaitForChild(). This method waits for the script to exist. local eai = require(game.ServerScriptService:WaitForChild("Modulez").Classes.Enemy.EnemyAI)

If neither of these work, try to add the module script to a different parent.

Maybe your output gives you some hints during using those solutions.

Good luck!

Are you accessing the module from a local script? You can only access things from server script service from the server. If you need to access the module from a localscript, put it somewhere else.

1 comment

0

I think you are not able to interact with scripts inside ServerScriptService. They run but they are not interactable.

Serverscriptservice can be only called by module/localscripts, make sure your localscript or modulescript are in workspace or starterpack (place the local or modeulescript into starterpack if the script call game.Players.LocalPlayer)

This discussion is preserved as it was. New answers, comments, and votes are closed.