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

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

Asked by 5 years ago

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

Log in to vote
0
Answered by 5 years ago

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!

Ad
Log in to vote
1
Answered by
royaltoe 5144 Moderation Voter Community Moderator
5 years ago

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.

0
I think you are not able to interact with scripts inside ServerScriptService. They run but they are not interactable. bostaffmanbulgaria1 89 — 5y
Log in to vote
0
Answered by
gloveshun 119
5 years ago
Edited 5 years ago

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)

Answer this question