|
You could make something along the lines of
for c,v in pairs(script.Parent:GetChildren()) do
if v.ClassName == "Part" then
"Insert CFraming here"
end
In this case, "v" would be every part belonging to the model.
You could then just assign a new CoordinateFrame to v and it would effect every part that is the "Child" of the model.
I added ClassName just to check incase you have any other children of the model that isn't a part howver :IsA() works just aswell. |
|
|
for c,v in pairs(Workspace:GetChildren()) do
if v.Name == "Map1" then
--Code Here
end
In this case, "v" would be the child. |
|
|
Alright
The Value = Instance.new("IntValue")
Creates a brand new NumericalValue for the player,
from there you can just use Value = NumberValueHere to set it's leaderboard value and finally,
the Value.Parent = Player
Just changes it so it becomes a "Child" of the player in game.Players which you find in the explorer tab. |
|
|
for c,v in pairs(game.Players:GetChildren()) do
v.Character:MoveTo(Target.Position)
end
"v" would be any children in the players child table. |
|
|
http://wiki.roblox.com/index.php?title=Function_dump/Basic_functions#next
It basically just allows you to get a child of a table via choosing it's position. |
|
|
You need to check if x actually has a parent and if the parent actually has a child named "Humanoid",
if x.Parent and x.Parent:FindFirstChild("Humanoid") then
--Code Here
end |
|
|
table = {player1 = 1, player2 = 2, player3 = 3, player4 = 4, enemy1, enemy2, enemy3, enemy4}
if table[player1] < table[player2] then
print("Player1 has defeated Player2")
end
In the above example, I changed the the parenthesis into curley brackets which is the main method of creating a table, I turned each player into a variable containing the value of 1, and I removed some other unnecessary characters, I then add an if statement to check which has the greater value and if the child of table "pl... |
|
|
That's not necessary as for instance,
talk[1] would select first child in the table. |
|
|
Alright, here you go,
Part = Instance.new("Part") --This is a comment. comments do not effect the actual script at all, use them for documentation and such if you want.
--Part = Instance.new("Part") would create a brand new brick named "Part" which is the default name, however we need to assign a Parent to this part so I will use.
Part.Parent = game.Workspace --This will turn the part into a physical 3D object within workspace as a "child" which we can add additional code to interact with.
Part.... |
|
|
for _,v in pairs(game.Workspace:GetChildren()) do
if v.Name == "Part" then
v.BrickColor = BrickColor.new("Magenta")
end
end
--What I basically did was loop through the children of workspace using a generic for loop to get the children and then I used .Name to determine the name of the child. |
|
|
Create the script, then
ScriptClone = script:clone()
game.Workspace.ChildAdded:connect(function(Child)
if Child.ClassName == "Part" then
ScriptClone.Parent = v
end
end) |
|
|
Modify it so that the new TextLabel is a child of the original one and change the Udim2.new() to move it down if it's a child of it. |
|
|
Is the child inside Workspace or one of the children of Workspace?. |
|
|
Also, regarding your question about pairs, yes, it can be used to search through things, I'll give an example.
Table = {"One","Two","Three","Four","Five"}
for i,v in pairs(Table) do
print(i,v)
end
In this example, I created a table and used a pairs() loop to loop through the table and get all of the "Children", this would print the numerical order of each "Child" and the "Child"(s) name, this would be called the generic for, which you can read more about here,
http://wiki.roblox.com/index.php?ti... |
|
|
Try something like this,
Child = game.Workspace:FindFirstChild("111")
Child:Destroy() |
|
|
while wait() do
if game.Players.NumPlayers >= 4 then
for k,p in pairs(game.Players:GetChildren()) do
p.PlayerGui.ChildAdded:connect(function(Child)
if Child.Name == "Announcements" then
p.Player.PlayerGui.Announcements.Waiting.Visible = true
end
end)
end
end
end |
|
|
Is "Waiting" the child of "Announcements"?. |
|
|
Hmm, well if "Waiting" is the "Child" of "Announcements" then this will be rather interesting. |
|
|
while wait() do
if game.Players.NumPlayers >= 4 then
for k,p in pairs(game.Players:GetChildren()) do
p.PlayerGui.ChildAdded:connect(function(Child)
if Child.Name == "Announcements" then
if Child:FindFirstChild("Waiting") then
--Code Here
else
print("Waiting Not Found!")
end
end
end)
end
end
end
|
|
|
Alright, I'll explain to help you,
Let's pretend that I have a bunch of Strings ranging from "One to "Five" and I want to arrange these in order and store them together, I would of course, create a table,
NumTab = {"One","Two","Three","Four","Five"}
However, what if I decide I want to find a specific string by searching directly through the table, well in this case, I will use a generic for loop to do that, I also want to find "Two".
for i,v in pairs(NumTab) do
if v == "Two" then
print("Two has ... |
|
|
GetChildren() retrieves the table, :Clone() is for Cloning an individual "Child" of the table. |
|
|
Is the SurfaceGUI the "Child" of a physical "Part" in Workspace?. |
|
|
An example would be,
NumTab = {"One","Two,"Three"}
table.remove(NumTab,3)
That would remove "Three" because "Three" is corresponding to the third "Child" in numerical order of the table "NumTab". |
|
|
In theory, the first "=" would be for the first "Child"(Depending on the case) and the second "=" would be for the second. |
|
|
game.Workspace.ChildAdded:connect(function(Child)
if Child.Name == "INfecTION" then
Child:Destroy()
end
end) |
|