Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How do I have a directory in directory?

Asked by 3 years ago
Edited 3 years ago

Hi for some reason I can't find anything about this but how would I do this?

game.Players.Player.Name

Player.Name would be the directory inside the directory. Also, I have the

local Player = game.Players.LocalPlayer

As the variable.

0
What exactly are you trying to do? What is the goal of your code? WizyTheNinja 834 — 3y
0
I think he trying to randomly get a player out of Players, and affect them. Nervousmrmonkey2 118 — 3y

3 answers

Log in to vote
0
Answered by 3 years ago

if you do Player.Name it looks for it's property called Name, use FindFirstChild, it will look for children of the directory only:

game.Players.Player:FindFirstChild('Name')

Or am i missing something?

Ad
Log in to vote
0
Answered by 3 years ago

Well, how I am doing it I have a list of all the players as a bool value. And I want to filter it out with just the one player who is affected.

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago
local Players = game.Players:GetPlayers()
local nplrs = #Players
local Randomplayer = nil
if nplrs > 0 then
     Randomplayer = Players[math.random(1, nplrs)]
    --Do your function here
end
0
Hope This Helped :D Nervousmrmonkey2 118 — 3y
0
Not really but I was able to make it work. TheReverseGaming 29 — 3y
0
oh ok Nervousmrmonkey2 118 — 3y

Answer this question