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

How do I hide a module script so people can't get access to it in studio?

I'm trying to watermark my hard work, but the > script=nil isn't working and gives me an error. Here's whats in my module script:

script = nil
local module = {}
local ScreenGui = Instance.new("ScreenGui")
local TextLabel = Instance.new("TextLabel")

ScreenGui.Parent = game.StarterGui

TextLabel.Parent = ScreenGui
TextLabel.BackgroundColor3 = Color3.new(1, 1, 1)
TextLabel.BackgroundTransparency = 1
TextLabel.Size = UDim2.new(0, 200, 0, 50)
TextLabel.Font = Enum.Font.SourceSans
TextLabel.Text = "DEEFUSION"
TextLabel.TextColor3 = Color3.new(0.564706, 0.564706, 0.564706)
TextLabel.TextScaled = true
TextLabel.TextSize = 14
TextLabel.TextStrokeColor3 = Color3.new(0.564706, 0.564706, 0.564706)
TextLabel.TextTransparency = 0.91000002622604
TextLabel.TextWrapped = true
return module

I'm also a bit of a noob, so please go easy on me!

1 answer

What you are looking for is a private module.

What you did with the script = nil part is correct, but you need to upload your Module script to Roblox first to use it. Rename your ModuleScript to MainModule, and upload it to Roblox (make sure it's not free to take - otherwise, this whole process will be useless!).

Then, when you want yourself and others to use this Module, you may do so by calling

require(assetIdOfPrivateModuleFoundInItsUrl)

at the top of your script that needs it.

Be aware that other people cannot test scripts that require your Module in Roblox Studio, because they do not own it, so it will consequently error for them (it will work fine in-game though). However, you should have no problem testing in Roblox Studio since you do own it.

Thus, your Module is now private, and it is protected from other people.

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