So basically, my module script is in ServerScriptService, and I’m trying to require it like this,
local required = require(game.ServerScriptService.Script)
What’s inside the script:
local module = {}
function module.GetHumanoid(otherPart)
local player = otherPart.Parent:FindFirstChild("Humanoid")
end
return module
And yet, I keep getting this error,
Even though it’s clearly in ServerScriptService. Can someone tell me what I did wrong?
Moonvane
(Moonvane)
November 3, 2020, 6:50pm
2
The name of the script is serverscriptservice needs to be “Script” in order for this to work.
That is the name if the module script.
Moonvane
(Moonvane)
November 3, 2020, 6:52pm
4
the problem could be not using game.ServerScriptService:WaitForChild(“Script”)
What is the name of the ModuleScript? If it’s not named “Script”, then that’s your issue.
1 Like
Still a no go. I don’t know what I did wrong though. The script is named “Script”, so maybe it’s a bug?
Could you send a screenshot of your explorer window? There might be other conflicting names.
In the workspace, there is just a baseplate.
oof0m
(Pug)
November 3, 2020, 6:57pm
9
the blue line in the error screenshot looks like you’re trying to access something in serverscriptservice on the client. you can’t do this. try putting the module in ReplicatedStorage.
The issue is the client can’t see any children of ServerScriptService. If you don’t understand, here is a great resource for that .
Okay, I fixed that problem, now there’s another.
I’m getting the script from serverscriptservice to the shift script you see in StarterCharacterScripts.
oof0m
(Pug)
November 3, 2020, 7:03pm
14
if you want to return something in a function, use “return”. you’re not returning anything in the function so you need to add
return player
after defining the local variable.