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

Custom password hash system not working as intended?

Asked by 5 years ago
Edited 5 years ago

Hello everyone! So recently I saw some videos on a password hash system. It was not on Roblox but it inspired me to try to create my own. Now, as I knew this wouldn't work on the first try, I need a bit of help understanding what the problem is. I cannot seem to locate it but the output does give an error. Errors: 04:00:52.466 - ServerScriptService.RecieveHashRequest:29: attempt to index local 'event' (a nil value) | 04:01:04.196 - Players.suspectshot108.PlayerGui.Password.Input.Fire:29: attempt to index upvalue 'event' (a nil value)

It would be great to get some help. Also, if you were wondering, this is just a fun test.

Local Script

local event
local hashList = {
    "q",
    "g",
    "y",
    "o",
    "z",
    "x"
}

for _,v in next, hashList do
    for _,e in pairs(game:GetService"ReplicatedStorage":GetDescendants()) do
        if e:IsA("RemoteEvent") then
            print 'Begining Sequence.'
            if e.Name:sub(1,3)==1 or e.Name:sub(1,3)==2 or e.Name:sub(1,3)==3 then
                print 'First section'
                if e.Name:find(e.Name:sub(4), v) then
                    print 'Second section'
                    if e.Name:sub(5)==1 or e.Name:sub(5)==2 or e.Name:sub(5)==3 then
                        print 'Third section'
                        if e.Name:find(e.Name:sub(7), v) then
                            print 'Fourth section'
                            event = e
                            print 'Found.'
                        end
                    end
                end
            end
        end
    end
end

script.Parent.FocusLost:Connect(function()
    if script.Parent.Text:len() >= 8 then
        event:FireServer(script.Parent.Text)
    else
        script.Parent.Text = "";
        script.Parent.PlaceholderText = "Input password must be 8 characters or longer."
    end
end)

Server Script 1/2 - Encrypt Remote

local event = game:GetService("ReplicatedStorage").enc
local rad = math.random

if event then
    local hashList = {
        "q",
        "g",
        "y",
        "o",
        "z",
        "x"
    }
    event.Name = (rad(1,3)..hashList[rad(1,6)]..rad(1,3))
end

Server Script 2/2 - Recieve Hash Request

local hashList = {
    "q",
    "g",
    "y",
    "o",
    "z",
    "x"
}
local event
local passwordData = game:GetService("DataStoreService")
local data = passwordData:GetDataStore("null")

for _,v in next, hashList do
    for _,e in pairs(game:GetService"ReplicatedStorage":GetDescendants()) do
        if e:IsA("RemoteEvent") then
            print 'Begining Sequence.'
            if e.Name:sub(1,3)==1 or e.Name:sub(1,3)==2 or e.Name:sub(1,3)==3 then
                print 'First section'
                if e.Name:find(e.Name:sub(4), v) then
                    print 'Second section'
                    if e.Name:sub(5)==1 or e.Name:sub(5)==2 or e.Name:sub(5)==3 then
                        print 'Third section'
                        if e.Name:find(e.Name:sub(7), v) then
                            print 'Fourth section'
                            event = e
                            print 'Found.'
                        end
                    end
                end
            end
        end
    end
end

event.OnSereerEeent:Connect(function(fired, password)
    local pass = tostring(password)
    local new

    if pass:len() >= 8 then
        return
    else
        for _,e in next, hashList do
            new = string.gsub(pass:sub(3), hashList[math.random(1,6)], pass:sub(3))
            data:SetAsync("p@ssw0rd"..new.."__"..fired.UserId)
            print("p@assw0rd"..new.."__"..fired.UserId)
        end
    end
end)

It would be really great to get some help on this project!

0
It is currently 4:11 AM where I live, so I am very tired. So if my code seems off, that's why. namespace25 594 — 5y
0
Well that's probarly because event isn't an object yet, maybe the if statments inside your in pairs loop didnt function correctly so event must've been not set to "e" starmaq 1290 — 5y
1
Can you please try adding some prints inside each if statment to see if the object is passing or not starmaq 1290 — 5y
0
Sure. namespace25 594 — 5y
View all comments (34 more)
1
and try printing event to see what it returns starmaq 1290 — 5y
1
ty! starmaq 1290 — 5y
0
Ok, I did that. But nothing came up. It just stated the same error. The prints did not even run. namespace25 594 — 5y
1
okkk starmaq 1290 — 5y
1
that means the loop isnt even looping starmaq 1290 — 5y
0
oh wait sorry, did you put a print inside the loop but not inside the if statment? starmaq 1290 — 5y
0
It just prints "Begining sequence" 90 times. Which I am fine with but it doesn't print anything else. Which must mean that the following line has incorrect code. But what about it is incorrect? namespace25 594 — 5y
0
No, there are prints in the if statement. namespace25 594 — 5y
1
where is the print that prints Begining sequence? is it inside the 1st if statment starmaq 1290 — 5y
0
Yes. namespace25 594 — 5y
0
ok starmaq 1290 — 5y
1
then its probarly passing throug the first if statment, but stops at the other ones and that's cuz the condition isnt met starmaq 1290 — 5y
1
What is the remote's name that youre looking for? starmaq 1290 — 5y
0
That's the problem. Look at the second server script. It randomly names the event and in the first server script, it tries to calculate the name and return it as the event. namespace25 594 — 5y
0
Wait, sorry. Let me add the second script. namespace25 594 — 5y
1
ohhhh ok starmaq 1290 — 5y
0
Ok, so it's the first server script names it and the second script does the calculating. namespace25 594 — 5y
1
what about you save that name after making it in a sting value object, in then just check if the remotes event is equal to that? starmaq 1290 — 5y
1
or is that not what you want? starmaq 1290 — 5y
0
:o good idear. Any suggestions? _G ? namespace25 594 — 5y
0
wym by suggestions? starmaq 1290 — 5y
0
Any suggestion on how to store the remote before renaming it. Think the _G variable would work? namespace25 594 — 5y
1
yah it would starmaq 1290 — 5y
0
Ok, I will try it. namespace25 594 — 5y
1
ok goodluck! starmaq 1290 — 5y
0
Gives the same errors. namespace25 594 — 5y
0
But I think with a little tweaking it will work! Thanks for the help. namespace25 594 — 5y
0
I'm happy to help! tell me if it works! starmaq 1290 — 5y
0
Don User#24403 69 — 5y
1
Don starmaq 1290 — 5y
1
can someone upvote all myc omments xd starmaq 1290 — 5y
1
i said all but thanks xd starmaq 1290 — 5y
0
So it worked?* starmaq 1290 — 5y
0
~no~ namespace25 594 — 5y

Answer this question