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: :GetChildren() not returning all children

Previous Thread :: Next Thread 
Rocky28447 is not online. Rocky28447
Joined: 11 Dec 2009
Total Posts: 2912
31 May 2016 03:24 PM
I'm trying to make a verification system so a hacked client (person hacking on the client) can't just add things into the Workspace, however I'm running into a bit of trouble while sending over from the client to the server an Instance that was added to a folder in the Workspace, and comparing that with what the server finds in the folder, and seeing if it finds the Instance sent over from the client. However, the Server only sees the same thing, and nothing that was added even from the server.

Example:
3 things in folder when game starts
Add 1 thing to folder from server
Server doesn't see it, thinks client added it

Here is the code:

VU.OnServerInvoke = function(PLAYER, ARGS)
local PARENT = ARGS[1]
local UNIT = ARGS[2]
local ADDED = ARGS[3]
local TEAM_COLOR = PLAYER.TeamColor
local TEAM = RS.GameData.Teams[tostring(TEAM_COLOR)]
local UNITS = game.Workspace.UnitData[tostring(TEAM_COLOR)]:GetChildren()

for _,v in pairs(UNITS) do
print(v.Name)
if (v == UNIT) then
if (ADDED == true) then
return true
else
return false
end
end
if (ADDED == true) then
return false
else
return true
end
end
end


choo choo
Report Abuse
CeaselessSoul is not online. CeaselessSoul
Joined: 03 Jul 2012
Total Posts: 7506
31 May 2016 03:40 PM
"can't just add things into the Workspace"

This is why there's FE.


Me: "Are you proud of me?" Matthew: "No... I'm not."
Report Abuse
Rocky28447 is not online. Rocky28447
Joined: 11 Dec 2009
Total Posts: 2912
31 May 2016 03:41 PM
Yes, however the client will still be able to interact with the things it adds, so I need a function to remove anything it adds.


choo choo
Report Abuse
Rocky28447 is not online. Rocky28447
Joined: 11 Dec 2009
Total Posts: 2912
31 May 2016 05:47 PM
b1


choo choo
Report Abuse
Borsy is not online. Borsy
Joined: 31 Jul 2014
Total Posts: 15111
31 May 2016 05:48 PM
try adding wait(.345) to top of all scripts


ℋ𝓪 ℋ𝓪 𝓢𝓱𝓪𝓻𝒆 𝓘𝒇 𝓨𝓸𝓾 𝓐𝓰𝓻𝒆𝒆 😂😂😂😂 | originally Reset2378658
Report Abuse
Rocky28447 is not online. Rocky28447
Joined: 11 Dec 2009
Total Posts: 2912
31 May 2016 05:54 PM
It didn't do anything different.


choo choo
Report Abuse
Casualist is not online. Casualist
Joined: 26 Jun 2014
Total Posts: 4443
31 May 2016 05:59 PM
:GetChildren() does return all children

This is going to be usage//implementation error. That code looks fine.
Report Abuse
Rocky28447 is not online. Rocky28447
Joined: 11 Dec 2009
Total Posts: 2912
31 May 2016 06:01 PM
For some reason it is either not getting called every time the server is invoked, or it is just not returning all the children. I don't see why either one of those situations would happen.


choo choo
Report Abuse
LateralLace is not online. LateralLace
Joined: 19 Sep 2015
Total Posts: 662
31 May 2016 06:11 PM
Even if this would work, a hacker can simplily "lie" about what it's creating. Now when the client would send the info, it would send a fake copy of a valid client workspace (one that's not hacked), and the real contents for that workspace would be a secret and no one would know. That way the server would "think" that the client is clean.

If you don't want the player to be able to interact with it's surronding (for example not being able tp walk across something) you could just monitor the client's movement from the server. If the client is walking on an invalid object (walking on nothing), then BAM. He's caught.

If you were'nt trying to see if the client was adding objects to it's own workspace (ex. local parts), well then I just wasted 90 seconds of you life! Hopefully this helped!
Report Abuse
Rocky28447 is not online. Rocky28447
Joined: 11 Dec 2009
Total Posts: 2912
31 May 2016 06:14 PM
That wasn't the kind of interacting with things I was talking about. I'm currently making a remake of the Conquerors, and the kind of interacting I was talking about was people cloning in "dirty" buildings and using them to create troops.


choo choo
Report Abuse
Rocky28447 is not online. Rocky28447
Joined: 11 Dec 2009
Total Posts: 2912
31 May 2016 06:31 PM
After further experimentation, it seems that the :GetChildren() method is only returning the first child added to the folder after it has been emptied. Either that or that is the only one being processed in the for loop.


choo choo
Report Abuse
Casualist is not online. Casualist
Joined: 26 Jun 2014
Total Posts: 4443
31 May 2016 06:33 PM
for _,v in pairs(UNITS) do
print(v.Name)
if (v == UNIT) then
if (ADDED == true) then
return true
else
return false
end
end
if (ADDED == true) then
return false
else
return true
end
end




--// This segment guarantees that only the first object is processed.
if (ADDED == true) then
return false
else
return true
end
Report Abuse
Rocky28447 is not online. Rocky28447
Joined: 11 Dec 2009
Total Posts: 2912
31 May 2016 06:35 PM
How so? "This segment" only happens if "v == unit".


choo choo
Report Abuse
Rocky28447 is not online. Rocky28447
Joined: 11 Dec 2009
Total Posts: 2912
31 May 2016 06:36 PM
Oh nevermind you were talking about the second one not the first one. Yes I realize now that "this segment" should be OUTSIDE the for loop...


choo choo
Report Abuse
Rocky28447 is not online. Rocky28447
Joined: 11 Dec 2009
Total Posts: 2912
31 May 2016 06:37 PM
I thought it WAS outside the for loop, but apparently it wasn't.


choo choo
Report Abuse
Rocky28447 is not online. Rocky28447
Joined: 11 Dec 2009
Total Posts: 2912
31 May 2016 06:41 PM
@Casualist It works flawlessly now, and I thank you for catching that.


choo choo
Report Abuse
Casualist is not online. Casualist
Joined: 26 Jun 2014
Total Posts: 4443
31 May 2016 06:53 PM
Happy to help!
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