|
| 03 Jun 2014 04:59 PM |
Error is on line 18
function killall() for i,v in pairs (game.Workspace:GetChildren()) do if v.Humanoid ~= nil then v.Humanoid.Health = 0 player = game.Players:GetPlayerFromCharacter(v) player.TeamColor = BrickColor.new("Really black") end end end
function choose() p = game.Players:GetChildren() for i,v in pairs (game.Players:GetChildren()) do if v.ClassName =="Player" then v.TeamColor = BrickColor.new("Lime green") end chosen = math.random(1,#p) chosen.TeamColor = BrickColor.new("Really red") end end
function teleport() for i,c in pairs (game.Workspace:GetChildren()) do if c.ClassName == "Model" and c.Humanoid ~= nil then c.Torso.CFrame = game.Workspace.Teleport.CFrame * CFrame.new(5,1,5) end end end
local allPlayersDead = false local bossDead = false
function check()
end for i, collect in pairs (game.Players:GetChildren())do if collect.ClassName == "Player" then if collect.TeamColor == "Lime green" or collect.TeamColor == "Really red" then print("Running") else m = Instance.new("Hint") m.Parent = game.Workspace m.Text = 'Round Over' end end end
while wait(30) do choose() teleport() check() wait(10) killall() end |
|
|
| Report Abuse |
|
|
|
| 03 Jun 2014 05:00 PM |
I showed where the error is.
function killall() for i,v in pairs (game.Workspace:GetChildren()) do if v.Humanoid ~= nil then v.Humanoid.Health = 0 player = game.Players:GetPlayerFromCharacter(v) player.TeamColor = BrickColor.new("Really black") end end end
function choose() p = game.Players:GetChildren() for i,v in pairs (game.Players:GetChildren()) do if v.ClassName =="Player" then v.TeamColor = BrickColor.new("Lime green") end chosen = math.random(1,#p) chosen.TeamColor = BrickColor.new("Really red") ---Attempt to call a numbervalue? end end
function teleport() for i,c in pairs (game.Workspace:GetChildren()) do if c.ClassName == "Model" and c.Humanoid ~= nil then c.Torso.CFrame = game.Workspace.Teleport.CFrame * CFrame.new(5,1,5) end end end
local allPlayersDead = false local bossDead = false
function check()
end for i, collect in pairs (game.Players:GetChildren())do if collect.ClassName == "Player" then if collect.TeamColor == "Lime green" or collect.TeamColor == "Really red" then print("Running") else m = Instance.new("Hint") m.Parent = game.Workspace m.Text = 'Round Over' end end end
while wait(30) do choose() teleport() check() wait(10) killall() end |
|
|
| Report Abuse |
|
|
| |
|
|
| 03 Jun 2014 05:17 PM |
p = game.Players:GetChildren() for i,v in pairs (game.Players:GetChildren()) do if v.ClassName =="Player" then v.TeamColor = BrickColor.new("Lime green") end chosen = math.random(1,#p) -- Chosen is a number... chosen.TeamColor = BrickColor.new("Really red") ---Attempt to call a numbervalue?
To fix, replace the defining 'chosen' line with this:
chosen = p[math.random(1, #p)] |
|
|
| Report Abuse |
|
|
|
| 03 Jun 2014 05:21 PM |
Thx but now there is an error on line 3
function killall() for i,v in pairs (game.Workspace:GetChildren()) do if v.Humanoid ~= nil then -- humanoid isn't a valid child of terrain :/ v.Humanoid.Health = 0 player = game.Players:GetPlayerFromCharacter(v) player.TeamColor = BrickColor.new("Really black") end end end |
|
|
| Report Abuse |
|
|
|
| 03 Jun 2014 05:22 PM |
Hey! Nice attempt! Just some small tips!
In your killall function, it's a lot more effecient to loop through players!
function killall() for i,v in pairs (game.Players:GetPlayers()) do if v.Character:FindFirstChild("Humanoid") then v.Character.Humanoid.Health = 0 v.TeamColor = BrickColor.new("Really black") end end end
Along same thing here:
function teleport() for i,c in pairs (game.Players:GetPlayers()) do if c.Character:FindFirstChild("Torso") then c.Character.Torso.CFrame = game.Workspace.Teleport.CFrame * CFrame.new(5,1,5) end end end
Now to fix the choose function The reason it's erroring is because you're trying to set the Color of a random number e.o
This should fix it
function choose() p = game.Players:GetPlayers() for i,v in pairs(p) do v.TeamColor = BrickColor.new("Lime green") end rand = math.random(1,#p) randplr = game.Players[rand] randplr.TeamColor = BrickColor.new("Really red") end
This part here is confusing me: function check()
end
An empty function?
And also:
Change this
for i, collect in pairs (game.Players:GetChildren())do if collect.ClassName == "Player" then if collect.TeamColor == "Lime green" or collect.TeamColor == "Really red" then
To
for i, collect in pairs(game.Players:GetPlayers()) do if collect.TeamColor == BrickColor.new("Lime green") or collect.TeamColor == BrickColor.new("Really red") then
|
|
|
| Report Abuse |
|
|
| |
|