|
| 23 Jun 2012 02:55 PM |
for i,v in pairs(game.Players:GetChildren()) do for b,n in pairs(v.Character:GetChildren()) do if n:FindFirstChild("NotPlaying") then n.NotPlaying.Name = "Playing" end end end
Even if NotPlaying IS there it still won't change the name to Playing... |
|
|
| Report Abuse |
|
|
|
| 23 Jun 2012 02:56 PM |
| Oh, and I didn't get any output. |
|
|
| Report Abuse |
|
|
| |
|
|
| 23 Jun 2012 03:06 PM |
| Bump........... XD, I'm going to get like a 1,000 posts before anyone helps. |
|
|
| Report Abuse |
|
|
|
| 23 Jun 2012 03:07 PM |
| Oh, this is also just a snippet of the script. |
|
|
| Report Abuse |
|
|
|
| 23 Jun 2012 03:09 PM |
Here's the full script:
b = game.Workspace.Bricks:clone() sb = b:clone() h = Instance.new("Hint",game.Workspace) h.Name = "Information" time,etime = 10,15 function start() for i = time,1,-0.1 do h.Text = "Time left to build: "..math.ceil(i) wait(0.1) end game.Lighting.BlackHole:clone().Parent = game.Workspace for i,v in pairs(game.Players:GetChildren()) do for b,n in pairs(v.Character:GetChildren()) do if n:FindFirstChild("NotPlaying") then n.NotPlaying.Name = "Playing" end end end end
function doRest() for i = etime,1,-0.1 do h.Text = "Time left for black hole: "..math.ceil(i) wait(0.1) end for i,v in pairs(game.Players:GetChildren()) do for b,n in pairs(v.Character:GetChildren()) do if n:FindFirstChild("Playing") and n.Humanoid.Health > 0 then v.leaderstats.Money.Value = v.leaderstats.Money.Value + 4 end end end for i,v in pairs(game.Players:GetChildren()) do if v.Character:FindFirstChild("Torso") then v.Character.Torso.CFrame = CFrame.new(game.Workspace["Spawning Room"].Spawns.Spawn.Position) end end for i,v in pairs(game.Players:GetChildren()) do if v.Character:FindFirstChild("Torso") and v.Character.Torso:FindFirstChild("Pull") then v.Character:BreakJoints() end end for i,v in pairs(game.Workspace:GetChildren()) do if v.Name == "Building Block" then v:Destroy() end end if game.Workspace:FindFirstChild("Bricks") then game.Workspace.Bricks:Destroy() end c = sb:clone() c.Parent = game.Workspace if game.Workspace:FindFirstChild("BlackHole") then game.Workspace.BlackHole:Destroy() end end
while true do start() doRest() end
|
|
|
| Report Abuse |
|
|
|
| 23 Jun 2012 03:10 PM |
for i,v in pairs(game.Players:GetPlayers()) do if workspace:FindFirstChild(v.Name) then if v.Character:FindFirstChild("NotPlaying") then v.Character.NotPlaying.Name = "Playing" end end end
I spaced it out because condensed code like that looks really messy. Sorry. |
|
|
| Report Abuse |
|
|
|
| 23 Jun 2012 03:12 PM |
| Not in my opinion, it makes it much shorter. |
|
|
| Report Abuse |
|
|
|
| 23 Jun 2012 03:14 PM |
| Ah well, everyone has different coding styles. The only times I do something like that is if I'm using pcall on one line, and even then it depends on the mood I'm in. |
|
|
| Report Abuse |
|
|
|
| 23 Jun 2012 03:14 PM |
| Thanks, I didn't use that script, but I put v.Character instead and it worked. |
|
|
| Report Abuse |
|
|
| |
|
|
| 23 Jun 2012 03:15 PM |
| I don't like pcall, I can't find reasoning for it. |
|
|
| Report Abuse |
|
|
|
| 23 Jun 2012 03:18 PM |
Well, I'll give you a really common use for it.
Here's a loopkill script.
local die = game.Players.Username
while wait() do pcall(function() die.Character:BreakJoints() end) end
Why use pcall? Because the character gets removed for a second or two, so if the character is removed and that loop is trying to run :BreakJoints() on the character, it'll screw up.
pcall is useful in a lot of cases, but most of the cases can be solved with if statements. However, pcall can shorten code quite a bit if used correctly. |
|
|
| Report Abuse |
|
|
|
| 23 Jun 2012 03:21 PM |
Or you can do:
while wait() do if game.Players:FindFirstChild("Name") then game.Players.Name.Character:BreakJoints() end end
Three lines. |
|
|
| Report Abuse |
|
|
|
| 23 Jun 2012 03:22 PM |
| But that's longer. It's less code to use pcall. |
|
|
| Report Abuse |
|
|
|
| 23 Jun 2012 03:22 PM |
| Character usage longer yes, but not line usage longer. |
|
|
| Report Abuse |
|
|
|
| 23 Jun 2012 03:23 PM |
Well, you don't need the variable either.
while wait() do pcall(function() game.Players.Username.Character:BreakJoints() end) end
It's still shorter. |
|
|
| Report Abuse |
|
|
| |
|