Returned dictionary returns only one key


So, from the server, I need to send a Dictionary filled with some player information.

The following code, sends a dictionary with that information.

local StatusTable = {}

StatusTable[playerEntry.Name] = {
	["BUILDING"] = playerEntry:GetAttribute("IsAllowedToBuild"),
	["DJ"] = playerEntry:GetAttribute("IsAllowedToPlayMusic")

However, there is one problem, when the client recieves this dictionary, the dictionary only has the “DJ” key.


Am I doing something wrong here? If so, how could I make it so that the both keys are sent?

1 Like

Are you just printing the ‘DJ’? Could you please re-check + send a small part of the code where you print.

1 Like

No, as seen in the output window screenshot, I am printing the whole StatusTable Dictionary, which should also print the BUILDING as well as the DJ key.

My only explanation is that on the server, the BUILDING key doesn’t get filled out.

Here is a part of the code where I print the dictionary. (On the client.)
Literally no more than 2 lines of code.

-- GetPrivilegeStatuses is a RemoteFunction.
local Statuses = GetPrivilegeStatuses:InvokeServer()
1 Like

Weird. Comment out the DJ, and check if it prints out the building or not?

1 Like

Just did that, for some reason, the BUILDING key also isn’t returned now…


I will check the whole playerEntry system, maybe something isn’t right there. It could be something as simple as a typo in the code…

(The playerEntry system is where I get these values from, maybe something is faulty over there.)

1 Like

Weird (2). Are you sure, you’re returning ‘BUILDING’?

1 Like

Okay, well I found out what was causing all this…

Aaaaand… It was a typo…

In just one script, I had one line of code which didn’t reference the attribute “IsAllowedToBuild”, it referenced an non-existing attribute “IdAllowedToBuild”.
Is → Id

Now, I don’t know why my code didn’t at least return the BUILDING key with the value set as false, but now that I’ve changed this typo, everything works as intended now…

At first, I thought that there was a different way to make dictionaries with multiple keys, but at the end it seems all of this was caused by a typo in a different script…

1 Like

Ah, yes. Glad you fixed it! People coming to help moment

1 Like

Probably think that since you were returning “IdAllowedToBuild”, which is not a valid attribute but it gets a new attribute. So, pretty sure that’s the reason that it didn’t work at first which was causing it to not error in the output as well.

Here, I’m getting an attribute that isn’t available but it isn’t erroring which was probably the reason you were confused why it wasn’t printing!

1 Like