But the Numbers 123 was random i want to compare the Code what a Player is sending from the Client with a RemoteEvent to the Server, but it will not compare the 123 (code) with the dictionary. Just if the variable is created inside the Server
1 Like
local dictionary = match[tostring(player.UserId)]
if dictionary[2] == code then
print("Works")
end
Also, try to print out some stuff, like - the code, etc. And see what returns
1 Like
Its returning nothing but i worked now but its weird.
I dont send the âŚTextBox.Text with a RemoteEvent to the Server first i put the âŚTextBox.Text inside a NumberValue and send it to the Server. It worked. But why its just working with the Value? Learned something new, but thank you for your help
1 Like
I think I am confused a bit, so I might not understand you for 100%.
local players = {
["95968697"] = {50,100,150}
}
game.ReplicatedStorage.Event.OnServerEvent:Connect(Sender,Code)
print(players[tostring(Sender.UserId)][2] -- does it print?
print(players[tostring(Sender.UserId)] -- does it print?
print(Code) -- does it print?
if players[tostring(Sender.UserId)][1] == Code then
print("success") -- does it print?
end)
Also, if your keys inside the dictionary have tables as their values, I suggest arranging them in 1 line, itâs more clear.
If any of the prints donât print out, it means thereâs an issue nearby that print. [not below, but before that print]
1 Like
I mean this
--Client:
script.Parent.Parent:WaitForChild("NumberValue").Value = script.Parent.TextBox.Text --If i wouldnt send it with the NumberValue it would not work.
game.ReplicatedStorage:WaitForChild("RemoteEvent"):FireServer(script.Parent.Parent:WaitForChild("NumberValue").Value)
--Server:
game.ReplicatedStorage:WaitForChild("RemoteEvent").OnServerEvent:Connect(function(code)
print(code) -- And it worked. If i wouldnt put the Code inside the Textbox.Text to the NumberValue and send it trought the NumberValue it would not work. But i dont know why, its weird, because it printet the Number in both.
end)
1 Like