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
 

help finding the child of game.Players

Previous Thread :: Next Thread 
imalex4 is not online. imalex4
Joined: 16 Aug 2012
Total Posts: 48
04 Mar 2015 08:38 PM
Normally with scripting, you can just do someone like

game.Workspace.Model.part

However, I can't do that with game.Players because the player names are always changing. How can I find the child/children of Players? (below is how the script will be used)

if not game.Players. (child) .Backpack:FindFirstChild("Dummy") then

Report Abuse
Darkmist101 is not online. Darkmist101
Joined: 30 Jul 2010
Total Posts: 6208
04 Mar 2015 08:40 PM
Um

for _, Player in pairs(game:GetPlayers()) do
end
Report Abuse
iiEssence is not online. iiEssence
Joined: 18 Jun 2014
Total Posts: 3467
04 Mar 2015 08:43 PM
It's impossible to get a specific player without using a local script.

However, it is possible to get each individual players:

for i = 1,#game.Players:GetChildren() do
print("Player number "..i.." is "..game.Players[i])
wait()
end
Report Abuse
imalex4 is not online. imalex4
Joined: 16 Aug 2012
Total Posts: 48
04 Mar 2015 08:45 PM
Can you tell me how I would incorporate that into:

if not game.Players. (child) .Backpack:FindFirstChild("Dummy") then
Report Abuse
iiEssence is not online. iiEssence
Joined: 18 Jun 2014
Total Posts: 3467
04 Mar 2015 08:47 PM
for i = 1,#game.Players:GetChildren()
if not game.Players[i].Backpack:FindFirstChild("Dummy") then
-- do stuff
end
end

This will 'do stuff' for each individual players
Report Abuse
dimm11 is not online. dimm11
Joined: 01 Sep 2012
Total Posts: 404
04 Mar 2015 08:47 PM
k
Report Abuse
superconscript is not online. superconscript
Joined: 15 Mar 2012
Total Posts: 413
04 Mar 2015 08:48 PM
You could possibly do this by using a local script
so
game.Players.LocalPlayer.Backpack:FindFirstChild ("Dummy")
Report Abuse
imalex4 is not online. imalex4
Joined: 16 Aug 2012
Total Posts: 48
04 Mar 2015 09:11 PM
Sorry, Superconscript, what you suggested did work in studio, but not when i tested it on server mode.

Let me be a bit more specific and show you the script as it is now.


function getinthere(part)
if part.Parent:FindFirstChild("Humanoid") and not workspace:FindFirstChild("Dummy") and not
part.Parent:FindFirstChild("Dummy") and not
game.Players. (child) .Backpack:FindFirstChild("Dummy") then
local dum = game.ServerStorage.Dummy:Clone()
dum.Parent = game.Workspace
end
end

script.Parent:FindFirstChild("DumTorso").Touched:connect(getinthere)


What happens is the player steps on a block and another block is spawned in close by. I am trying to make it so only one spawns in instead of an infinite number of them. The script checks to make sure no other block exists in workspace, under player in workspace, and in game.Players. (child) .backpack before spawning a block in. The server will only be single player.
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