Dark_YugiJoin Date: 2010-08-26 Post Count: 11036 |
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? |
|
Dark_YugiJoin Date: 2010-08-26 Post Count: 11036 |
help? |
|
Dark_YugiJoin Date: 2010-08-26 Post Count: 11036 |
Maybe someone can help. |
|
|
Someone should help this kid. |
|
Dark_YugiJoin Date: 2010-08-26 Post Count: 11036 |
@SuperNintendo
uhm
cool |
|
|
|
Dark_YugiJoin Date: 2010-08-26 Post Count: 11036 |
Uhm, okay? |
|
Dark_YugiJoin Date: 2010-08-26 Post Count: 11036 |
Help? |
|
CasualistJoin Date: 2014-06-26 Post Count: 4443 |
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) |
|
Dark_YugiJoin Date: 2010-08-26 Post Count: 11036 |
It just says in the output
Error: GameScript2 Line 72
which is
game.Workspace:FindFirstChild(Assassin).Humanoid.Died:connect(function() |
|
|
You forgot some quotations/" " around assassin |
|
Dark_YugiJoin Date: 2010-08-26 Post Count: 11036 |
I thought you don't need quotations to reference variables. |
|
|
Well if the script isn't working, I suggest giving it a try |
|
CasualistJoin Date: 2014-06-26 Post Count: 4443 |
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) |
|
Dark_YugiJoin Date: 2010-08-26 Post Count: 11036 |
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) |
|
Dark_YugiJoin Date: 2010-08-26 Post Count: 11036 |
Bump |
|