Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

Custom password hash system not working as intended?

Asked by 2 months ago
Edited 2 months 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("[email protected]"..new.."__"..fired.UserId)
            print("[email protected]"..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. suspectshot108 217 — 2mo
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 566 — 2mo
0
Can you please try adding some prints inside each if statment to see if the object is passing or not starmaq 566 — 2mo
0
Sure. suspectshot108 217 — 2mo
View all comments (34 more)
0
and try printing event to see what it returns starmaq 566 — 2mo
0
ty! starmaq 566 — 2mo
0
Ok, I did that. But nothing came up. It just stated the same error. The prints did not even run. suspectshot108 217 — 2mo
0
okkk starmaq 566 — 2mo
0
that means the loop isnt even looping starmaq 566 — 2mo
0
oh wait sorry, did you put a print inside the loop but not inside the if statment? starmaq 566 — 2mo
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? suspectshot108 217 — 2mo
0
No, there are prints in the if statement. suspectshot108 217 — 2mo
0
where is the print that prints Begining sequence? is it inside the 1st if statment starmaq 566 — 2mo
0
Yes. suspectshot108 217 — 2mo
0
ok starmaq 566 — 2mo
0
then its probarly passing throug the first if statment, but stops at the other ones and that's cuz the condition isnt met starmaq 566 — 2mo
0
What is the remote's name that youre looking for? starmaq 566 — 2mo
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. suspectshot108 217 — 2mo
0
Wait, sorry. Let me add the second script. suspectshot108 217 — 2mo
0
ohhhh ok starmaq 566 — 2mo
0
Ok, so it's the first server script names it and the second script does the calculating. suspectshot108 217 — 2mo
0
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 566 — 2mo
0
or is that not what you want? starmaq 566 — 2mo
0
:o good idear. Any suggestions? _G ? suspectshot108 217 — 2mo
0
wym by suggestions? starmaq 566 — 2mo
0
Any suggestion on how to store the remote before renaming it. Think the _G variable would work? suspectshot108 217 — 2mo
0
yah it would starmaq 566 — 2mo
0
Ok, I will try it. suspectshot108 217 — 2mo
0
ok goodluck! starmaq 566 — 2mo
0
Gives the same errors. suspectshot108 217 — 2mo
0
But I think with a little tweaking it will work! Thanks for the help. suspectshot108 217 — 2mo
0
I'm happy to help! tell me if it works! starmaq 566 — 2mo
0
Don incapaxx 2881 — 2mo
0
Don starmaq 566 — 2mo
1
can someone upvote all myc omments xd starmaq 566 — 2mo
0
i said all but thanks xd starmaq 566 — 2mo
0
So it worked?* starmaq 566 — 2mo
0
~no~ suspectshot108 217 — 2mo

Answer this question