Well, I am trying to return two values but doing so gives me the following error: 253: attempt to index nil with number. Before I put the two values to return, it was not giving me this error.
This is how I return the values:
Get_objects.OnClientInvoke = function(Service)
if Service == "Get_items" then
if Selected.Value ~= nil then
return {Selected.Value, Option_Seletected_bool.Value}
end
end
end
You do need them I think. You can only send one value through at a time if u do that. What he has tried to do is send a table through with mutiple values in which I think is the right way could just be the way he handels it on the other end.
What he did is exactly that just without the variable which should not affect it. Your still sending the same thing.
One other way he could try is by sending the data via an array not sure.
On the other end he should have some type of variable to collect the return which then can be used like a table like if the variable on the other end was called Response then it would be Response[0] to get the first thing from the table.
Is the Slots what ur returning? Like as the table I mean
I am asking cuz on that screenshot I see nowhere a [0] on it which would be the first value returned Could the problem be that u thought the first value was [1] so the [2] is then nothing (nil)?
local Get_Data = Get_objects_InvokeClient(player, "Get_items")
print(Get_Data[1]) --tool
print(Get_Data[2]) --BoolValue
return:
Get_objects.OnClientInvoke = function(Service)
if Service == "Get_items" and Selected.Value ~= nil then
return {Selected.Value, Option_Seletected_bool.Value}
end
end
What does the print(Get_Data[2]) because I think the second value should be [1] not [2] cuz if I remember correctly tables start at [0] and u only returned 2 values.
(might be wrong on that cuz I have not used tables for a while only in JS cuz i have been coding in JS more recently)