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 |
|
|
|
| 04 Mar 2015 08:40 PM |
Um
for _, Player in pairs(game:GetPlayers()) do end |
|
|
| Report Abuse |
|
|
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
|
  |
| 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
|
  |
| 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
|
  |
| Joined: 01 Sep 2012 |
| Total Posts: 404 |
|
| |
|
|
| 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
|
  |
| 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 |
|
|