Script is not valid?

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,

Why thou

Even though it’s clearly in ServerScriptService. Can someone tell me what I did wrong?

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.

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.

Work

In the workspace, there is just a baseplate.

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.

Roblox

I’m getting the script from serverscriptservice to the shift script you see in StarterCharacterScripts.

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.