|
Teams = game.Teams:GetChildren()
for _,v in pairs(game.Players:GetChildren()) do
v.TeamColor = Teams[math.random(1, #Teams)].TeamColor
end |
|
|
Here's an example,
for _,v in pairs(game.Players:GetChildren()) do
if v.TeamColor == BrickColor.new(TeamColorHere) then
v.Character.Head.Transparency = 1
end
end |
|
|
When making scripts, if you were making something such as a function or using if statements, you need to add an end when you're done so that the engine will understand that you're done with that segment of the script and will stop reading it. |
|
|
You'll have to compare the TeamColor property of the "Player" to the TeamColor property of the Team in the "Teams" table. The example I provided would have just checked the TeamColor per player, as for the solution you provided, it should work.
game.Players.PlayerAdded:connect(function(Player)
Player.CharacterAdded:connect(function(Character)
if Player.TeamColor == game.Teams.TeamNameHere.TeamColor then
Character.Head.Transparency = 1
end
end)
end)
That would be an example. |
|
|
An example would be
function Disable()
ScriptToBeDisabled = game.Workspace.ScriptOne
--Script Conditions
ScriptToBeDisabled.Disabled = true
end
Disable() |
|
|
|
Yes, that's what I was referring to. |
|
|
You have two parenthesis's on one of the end's. |
|
|
It's waiting for that player's Backpack to be added. |
|
|
--The for i,v in pairs(c:GetChildren()) do
Basically would look through all of the "Children" or objects within that specific player. |
|
|
Remove one of the parenthesis on the line with two. |
|
|
Nevermind, just a minute. |
|
|
If the LocalScript is placed in somewhere, such as the StarterPack or StarterGui, it will globally effect every player and would function almost as though it was a normal script. |
|
|
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... |
|
|
Create a LocalScript and store it somewhere then place this inside the LocalScript
game.StarterGui:SetCoreGuiEnabled("Chat", false)
--As for the regular script
LocalScript = LocalScriptPathHere:Clone()
UnAllowedList = {"PlayerNameHere","PlayerNameHere","PlayerNameHere"}
game.Players.PlayerAdded:connect(function(Player)
for _,v in pairs(UnAllowedList) do
if Player.Name == v then
LocalScript.Parent = Player.PlayerGui
end
end
end) |
|
|
Player = game.Players.LocalPlayer
Mouse = Player:GetMouse()
Mouse.KeyDown:connect(function(Key)
if Key == "f" then
for _,i in pairs(Player.Character:GetChildren()) do
if i.ClassName == "Part" then
i.Transparency = 0.9
end
end
end
end) |
|
|
Actually, use the one "FrostGlacier" made. |
|
|
No, functions have to be called via events or by using something like,
function Start()
end
Start() |
|
|
|
Loop through the children before the event activates. |
|
|
|
game.Players.PlayerAdded:connect(function(Player)
Player.TeamColor = game.Teams.TeamNameHere.TeamColor
end) |
|
|
Inside of a regular script. |
|
|
|
Here's an example
script.Parent.Touched:connect(function(Toucher)
if Toucher.Parent and Toucher.Parent:FindFirstChild("Humanoid") then
Toucher.Parent:MoveTo(Vector3.new(XNumberHere,YNumberHere,ZNumberHere))
end)
This example assumes that the script's Parent is the brick that you want the character to touch to move to the other brick. :MoveTo() moves a "Model" using Vector3. |
|