(Edited in order to include the attempt to fix it)
local module = require(game.ReplicatedStorage.Security)
Module is supposed to contain the remote security key, however it doesn’t work
Module contains:
local module = {}
module.RemoteSecurity = math.random(1000000, 9999999)
return module
1 Like
blokav
(blokav)
June 2, 2020, 5:10pm
#2
Use ReplicatedStorage for module scripts that are shared by server and client.
As a side note, if you are using this security key to validate calls to remote events and functions, be aware that it can still be read by a user since a local script is fetching it.
1 Like
I am aware of it, just to stop abuse of the remote events from starting exploiters
Thanks!
Canopius
(Canopius)
June 2, 2020, 5:12pm
#4
Please use three ` to open and close code blocks.
It is not recommended to store anything in Lighting now, you should use ReplicatedStorage if you want the client and server to have access to something, ServerScriptService if only the server needs access or StarterPlayer / Gui etc. if only the player needs access.
Still comes up with this, I changed the scripts and put it in ReplicatedStorage
blokav
(blokav)
June 2, 2020, 5:17pm
#6
Is there additional text that might show which script the error is coming from? Not the module, the one requiring the module.
The only error in the output is a plugin error
You can set a variable that sets a random key on server start, then set up a function that returns this key when called
local randomSecurity = math.random(1000000, 9999999)
local module = {}
function module.GetRandomSecurityKey()
return randomSecurity
end
return module
In a script, you can get this key by doing
local securityModule = require(game.ReplicatedStorage:WaitForChild("Security"))
local key = securityModule.GetRandomSecurityKey()
Still running in the same error, It’s getting quite confusing
make sure it’s (“Security”)) at the end
It’s already there, I put it in here
With the two parenthesis at the end?
The one you quoted didn’t have it.
You mean the:
local securityModule = require(game.ReplicatedStorage:WaitForChild("Security"))
If yes, It’s already in the script
It works for me; are you sure there aren’t 2 modulescripts?
in which case one would overwrite another
blokav
(blokav)
June 2, 2020, 5:27pm
#15
Is this the only code in your module script? It doesn’t look like it should throw any errors. Can you show all of the scripts that use that module, and their locations in the Explorer widget?
There is a single module
(30 chars)
Are you in a team-create? You need to push changes if so.
I’m not in a team create
(30 chars)
I’m interested in what @Blokav suggested you try
The script right now is
local randomSecurity = math.random(1000000, 9999999)
local module = {}
function module.GetRandomSecurityKey()
return randomSecurity
end
return module
by Awesom3_Eric
You mean I should give you the whole scripts?