Key System Logic, How to do it?

I want the key to be forever as possible. It’s like their only key. If the system detects that it enters the key, it will verify If the person that entered the key matches the corresponding owner in the table.

Do you have a gui already in place or something where the player could enter their key?

See above. Creating a datastore is easy. You can either use resources available on the Roblox API, or use a module like ProfileService.

I will soon. That’s why I am trying to know what logic behind it It’s like

local KeyHolder = {AmongUs69, LOL420}
local Key = {YOURKEYHERE, KEYHERELOL)

The system would do like

If Password is entered, it should match the corresponding another table which is Keyholder.

I will explain I just need to know how you have the key input system setup?

Let me tell you one thing. For example, I am a player and this owner called “TheGod” gave me a key called “YourOnlyKey”

If I am a player and I entered my key in the login system, of course I will get in but If I use my alt and enter the key, even If the key is correct; the player will not be able to logged in.

If you have bought any premium games or premium app digital or physically, I’m sure you’re gonna get what I’m trying to say by “Key system”

That’s not what im asking. Im asking for the technical side. Is there a remote or something that will be fired when someone submits a key?

What I expect is that it’s gonna look for the table, like.

System : “Woah, someone entered this key called THEKEYHERE! Hmm, wait. Let me check If the player who entered the key matches the corresponding owner which this key trusted to.”

THEKEYHERE – aruruy0155

“Hmmm, but the key called “THEKEYHERE” is only accessible by aruruy0155. The player who entered this key is called AmongUs69. I will reject his request to enter and deny him”

I don’t think we are on the same page here. Sorry if I sound rude but this isn’t what i was asking. I understand the idea of a key I have used private keys many times before too. Do you have any infrastructure(guis, or really any code) in place to input the key?

Oh. I’m sorry for not understanding what you mean. The key will be put inside the GUI/TextBox.

So do you understand remote functions and gui click events?

I know click events, I am a bit unfamiliar with remote events.

Ok so when a gui gets clicked, we want to take the text inside the input box and send it to the server so we can determine if the person and key are valid. Otherwise we can do what ever, like kick them.

–or deny their request! Yes, that’s what I mean.

So how do I do that? What syntax or logic were used behind that logic?

Here read this for an overview on remotes

For the syntax I would wait until you have your GUI in place so I can show you the code.

It’s already made. It’s just a TextBox which is where they will input the key and a login.

Do you understand datastores? dsdssddssdsdsfhgrfdgwse

When they input the “key” to the thing, use focuslost( i think ) ? signal to fire the event when they stop typing and send the new text to the remoteevent, from there check if the players userID is in the list of whitelisted people and that the key is correct. If you are using a datastore then u can check if their userid exists in the datastore, and check it against their key

for example
On the client

local textbox = yatextbox
textbox.FocusLost:Connect(function(enterPressed)
if enterPressed then
      keyRegister:FireServer(textbox.Text)
end

end)

And in a serverscript

-- this is without using datastore

local keyStorage = {{240800665, "AW892AJL'wA#"}, {1197440658, "AIWJOnjkuidaiszopW"} }

keyRegister.OnServerEvent:Connect(function(player, key)
     for i,v in keyStorage do
if table.find(v, player.UserId) then
 if key == v[1] then
 --Yayayy they are registerede and they inputted the right key
end

end

   end

end)

This should work, let me know if it does because i just typed this without debugging

If youre going to do this with datastore then you can do something like

datastore:setasync(UserId, Key)

then on the event use
onserverevent:connect(function(plr, inputtedKey)
key = datastore:getasync(plr.UserId)
if inputtedKey == key then
print(“hi im verified”)
end
end)

or someting liek that

1 Like