generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: can't pass getfenv() table via remotefunctions

Previous Thread :: Next Thread 
WishNite is not online. WishNite
Joined: 11 Feb 2009
Total Posts: 15828
01 Mar 2015 06:42 AM
server code
function game.ReplicatedStorage.InfoGet.OnServerInvoke(client,battleNumber)
print(battleNumber,getfenv()["Battle"..battleNumber])
return getfenv()["Battle"..battleNumber]
end

It prints >(1, table: BLAH), so the getfenv() value DOES work

client code
local info = game.ReplicatedStorage.InfoGet:InvokeServer(battleNumber)

error: keys must be strings

Report Abuse
BothAngles is not online. BothAngles
Joined: 01 Dec 2011
Total Posts: 9604
01 Mar 2015 06:53 AM
(1, table: BLAH)
Is that a table inside of a table? That might not work but I know tables do
Report Abuse
WishNite is not online. WishNite
Joined: 11 Feb 2009
Total Posts: 15828
01 Mar 2015 06:55 AM
the 1 is the battleNumber, the table part is just to confirm that IT is there is a table that exists on the server sided code

and yes, there is another table within the getfenv() table along with some other values
Report Abuse
BothAngles is not online. BothAngles
Joined: 01 Dec 2011
Total Posts: 9604
01 Mar 2015 07:01 AM
Sorry I didn't see the print statement before so idk what the parenthesis were from

function game.ReplicatedStorage.InfoGet.OnServerInvoke(client,battleNumber)
for i,v in pairs(getfenv()["Battle"..battleNumber]) do
print(i.." - "..type(v).." - "..tostring(v))
end

See what the table has
Report Abuse
WishNite is not online. WishNite
Joined: 11 Feb 2009
Total Posts: 15828
01 Mar 2015 07:06 AM
the parenthesis is cuz im dumb

here is how the tables are set up

getfenv()["Battle"..ticket] = {
[sender] = {["Opp"] = receiver,["Lead"] = nil,["Team"] = team(sender), ["Action"] = nil }
[receiver] = {["Opp"] = sender,["Lead"] = nil, ["Team"] = team(receiver), ["Action"] = nil}
}

the team function just returns a table
Report Abuse
WishNite is not online. WishNite
Joined: 11 Feb 2009
Total Posts: 15828
01 Mar 2015 07:06 AM
sender/receiver are PLAYER instances btw
Report Abuse
BothAngles is not online. BothAngles
Joined: 01 Dec 2011
Total Posts: 9604
01 Mar 2015 07:10 AM
getfenv()["Battle"..ticket] = {
["sender"] = {["Opp"] = receiver,["Lead"] = nil,["Team"] = team(sender), ["Action"] = nil }
["receiver"] = {["Opp"] = sender,["Lead"] = nil, ["Team"] = team(receiver), ["Action"] = nil}
}

You'll have to do it this way which shouldn't be too much trouble
Report Abuse
WishNite is not online. WishNite
Joined: 11 Feb 2009
Total Posts: 15828
01 Mar 2015 07:21 AM
any reason why??
Report Abuse
WishNite is not online. WishNite
Joined: 11 Feb 2009
Total Posts: 15828
01 Mar 2015 07:33 AM
same error persists
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
01 Mar 2015 07:43 AM
Boop.
Basically, it uses jsonEncode or some variety to send the table data. You can't use any object type (userdata) keys, nor can you use a mixture of the dictionary and array parts of the table.
Report Abuse
BothAngles is not online. BothAngles
Joined: 01 Dec 2011
Total Posts: 9604
01 Mar 2015 07:44 AM
Did you add a comma in the table after sender?

This works for me

local value = {
["sender"] = {["Opp"] = workspace.BasePlate,["Lead"] = nil,["Team"] = {}, ["Action"] = nil },
["receiver"] = {["Opp"] = workspace.BasePlate,["Lead"] = nil, ["Team"] = {}, ["Action"] = nil}
}
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image