Krosskode
|
  |
| Joined: 26 Aug 2010 |
| Total Posts: 11001 |
|
|
| 05 Jul 2014 07:54 PM |
Okay, I am trying to get a players humanoid through a variable. Currently, I have;
Okay, so I removed all of the locals and had no luck.
There was no output, and all my script is
game.ServerStorage["Give Items"].Event:connect(function() players = {} Assassin = "" Protector = ""
function GetPlayers() for i,v in pairs(game.Players:GetChildren()) do table.insert(players,v) end end
GetPlayers()
function SelectPlayer() num = math.random(1,#players) Assassin = players[num].Name print('Assassin is: ' ..Assassin) end
SelectPlayer()
function SelectPlayer2() num = math.random(1,#players) Protector = players[num].Name print('Protector is: ' ..Protector) end
SelectPlayer2()
if Assassin == Protector then SelectPlayer2() end
if Assassin == Protector then SelectPlayer2() end
if Assassin == Protector then SelectPlayer2() end
if Assassin == Protector then SelectPlayer2() end
if Assassin == Protector then SelectPlayer2() end
function Sword(player) player = game.Players:FindFirstChild(player) Sword = game.ServerStorage.MidnightSword:clone() if player~= nil then Sword.Parent=player.Backpack end end
function Bow(player) player = game.Players:FindFirstChild(player) Bow = game.ServerStorage.DynamicallyLitBow:clone() if player~= nil then Bow.Parent=player.Backpack end end
Sword(Assassin) Bow(Protector)
end)
AssassinPlayer = game.Workspace:FindFirstChild(Assassin)
if AssassinPlayer.Humanoid.Health == 0 then game.ServerStorage["Victims Won"]:Fire() end
When I reset, it didn't fire the the event.
There are no errors in the script, either. Nothing in output; nothing. Why? |
|
|
| Report Abuse |
|
|
Krosskode
|
  |
| Joined: 26 Aug 2010 |
| Total Posts: 11001 |
|
| |
|
Krosskode
|
  |
| Joined: 26 Aug 2010 |
| Total Posts: 11001 |
|
| |
|
|
| 06 Jul 2014 01:31 PM |
| Someone should help this kid. |
|
|
| Report Abuse |
|
|
Krosskode
|
  |
| Joined: 26 Aug 2010 |
| Total Posts: 11001 |
|
| |
|
| |
|
| |
|
Krosskode
|
  |
| Joined: 26 Aug 2010 |
| Total Posts: 11001 |
|
| |
|
Krosskode
|
  |
| Joined: 26 Aug 2010 |
| Total Posts: 11001 |
|
| |
|
Casualist
|
  |
| Joined: 26 Jun 2014 |
| Total Posts: 4443 |
|
|
| 07 Jul 2014 10:26 PM |
game.ServerStorage["Give Items"].Event:connect(function() players = {} Assassin = "" Protector = ""
function GetPlayers() for i,v in pairs(game.Players:GetChildren()) do table.insert(players,v) end end
GetPlayers()
function SelectPlayer() num = math.random(1,#players) Assassin = players[num].Name print('Assassin is: ' ..Assassin) end
SelectPlayer()
function SelectPlayer2() num = math.random(1,#players) Protector = players[num].Name print('Protector is: ' ..Protector) end
SelectPlayer2()
if Assassin == Protector then SelectPlayer2() end
if Assassin == Protector then SelectPlayer2() end
if Assassin == Protector then SelectPlayer2() end
if Assassin == Protector then SelectPlayer2() end
if Assassin == Protector then SelectPlayer2() end
function Sword(player) player = game.Players:FindFirstChild(player) Sword = game.ServerStorage.MidnightSword:clone() if player~= nil then Sword.Parent=player.Backpack end end
function Bow(player) player = game.Players:FindFirstChild(player) Bow = game.ServerStorage.DynamicallyLitBow:clone() if player~= nil then Bow.Parent=player.Backpack end end
Sword(Assassin) Bow(Protector)
end)
game.Workspace:FindFirstChild(Assassin).Humanoid.Died:connect(function() game.ServerStorage["Victims Won"]:Fire() end) |
|
|
| Report Abuse |
|
|
Krosskode
|
  |
| Joined: 26 Aug 2010 |
| Total Posts: 11001 |
|
|
| 07 Jul 2014 11:56 PM |
It just says in the output
Error: GameScript2 Line 72
which is
game.Workspace:FindFirstChild(Assassin).Humanoid.Died:connect(function() |
|
|
| Report Abuse |
|
|
|
| 08 Jul 2014 12:02 AM |
| You forgot some quotations/" " around assassin |
|
|
| Report Abuse |
|
|
Krosskode
|
  |
| Joined: 26 Aug 2010 |
| Total Posts: 11001 |
|
|
| 08 Jul 2014 12:13 AM |
| I thought you don't need quotations to reference variables. |
|
|
| Report Abuse |
|
|
|
| 08 Jul 2014 12:16 AM |
| Well if the script isn't working, I suggest giving it a try |
|
|
| Report Abuse |
|
|
Casualist
|
  |
| Joined: 26 Jun 2014 |
| Total Posts: 4443 |
|
|
| 08 Jul 2014 02:46 AM |
game.ServerStorage["Give Items"].Event:connect(function() players = {} Assassin = "" Protector = ""
function GetPlayers() for i,v in pairs(game.Players:GetChildren()) do table.insert(players,v) end end
GetPlayers()
function SelectPlayer() num = math.random(1,#players) Assassin = players[num].Name print('Assassin is: ' ..Assassin) end
SelectPlayer()
function SelectPlayer2() num = math.random(1,#players) Protector = players[num].Name print('Protector is: ' ..Protector) end
SelectPlayer2()
if Assassin == Protector then SelectPlayer2() end
if Assassin == Protector then SelectPlayer2() end
if Assassin == Protector then SelectPlayer2() end
if Assassin == Protector then SelectPlayer2() end
if Assassin == Protector then SelectPlayer2() end
function Sword(player) player = game.Players:FindFirstChild(player) Sword = game.ServerStorage.MidnightSword:clone() if player~= nil then Sword.Parent=player.Backpack end end
function Bow(player) player = game.Players:FindFirstChild(player) Bow = game.ServerStorage.DynamicallyLitBow:clone() if player~= nil then Bow.Parent=player.Backpack end end
Sword(Assassin) Bow(Protector)
end)
Assassin.Humanoid.Died:connect(function() game.ServerStorage["Victims Won"]:Fire() end) |
|
|
| Report Abuse |
|
|
Krosskode
|
  |
| Joined: 26 Aug 2010 |
| Total Posts: 11001 |
|
|
| 08 Jul 2014 11:44 PM |
Same line.
00:43:23.853 - ServerScriptService.GameScript2:72: attempt to index global 'Assassin' (a nil value) 00:43:23.855 - Script 'ServerScriptService.GameScript2', Line 72 00:43:23.856 - ServerScriptService.Script:1: attempt to index global 'character' (a nil value) |
|
|
| Report Abuse |
|
|
Krosskode
|
  |
| Joined: 26 Aug 2010 |
| Total Posts: 11001 |
|
| |
|