Dark_YugiJoin Date: 2010-08-26 Post Count: 11036 |
Is there anyway to find a humanoid through a variable?
I tried stuff like
game.Workspace:FindFirstChild(Assassin)
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()
local num = math.random(1,#players)
Assassin = players[num].Name
print('Assassin is: ' ..Assassin)
end
SelectPlayer()
function SelectPlayer2()
local 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)
local player = game.Players:FindFirstChild(player)
local Sword = game.ServerStorage.MidnightSword:clone()
if player~= nil then
Sword.Parent=player.Backpack
end
end
function Bow(player)
local player = game.Players:FindFirstChild(player)
local Bow = game.ServerStorage.DynamicallyLitBow:clone()
if player~= nil then
Bow.Parent=player.Backpack
end
end
Sword(Assassin)
Bow(Protector)
end) |
|
Dark_YugiJoin Date: 2010-08-26 Post Count: 11036 |
Help please? |
|
LacrymaJoin Date: 2010-02-15 Post Count: 22696 |
so vague
just post a script and expect us to know exactly what ur talking about
good job |
|
Dark_YugiJoin Date: 2010-08-26 Post Count: 11036 |
>Shows a method I used with FindFirstChild inside of workspace to find the assassin, still vague.
|
|
Dark_YugiJoin Date: 2010-08-26 Post Count: 11036 |
Did you even read the text I have at the top above the script? |
|
|
Remove the local infront of num and try it again. |
|
LacrymaJoin Date: 2010-02-15 Post Count: 22696 |
woah u found an assassin, u must feel very special |
|
LacrymaJoin Date: 2010-02-15 Post Count: 22696 |
"Finding Humanoid through variable?"
>does not see any attempt of trying to find humanoid |
|
Dark_YugiJoin Date: 2010-08-26 Post Count: 11036 |
You should really be like Anon and stop acting like an imbecile, dueling.
lol
And the character didn't even do anything when the health hit zero.
So I have this script
AssassinPlayer = game.Workspace:FindFirstChild(Assassin)
if AssassinPlayer.Health == 0 then
game.ServerStorage["Victims Won"]:Fire()
end
and the player doesn't die. |
|
Dark_YugiJoin Date: 2010-08-26 Post Count: 11036 |
bump |
|
LacrymaJoin Date: 2010-02-15 Post Count: 22696 |
oh cool the vagueness continues |
|
Dark_YugiJoin Date: 2010-08-26 Post Count: 11036 |
oh cool
you have nothing better to do with your life than complaining about someone whos been scripting for a week
congrats |
|
|
Remove all of the locals and inform us of the result. |
|
|
Also,
AssassinPlayer = game.Workspace:FindFirstChild(Assassin)
if AssassinPlayer.Humanoid.Health == 0 then
game.ServerStorage["Victims Won"]:Fire()
end
|
|
Dark_YugiJoin Date: 2010-08-26 Post Count: 11036 |
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)
AssassinHumanoid = game.Workspace:FindFirstChild(Assassin)
if AssassinHumanoid.Health == 0 then
game.ServerStorage["Victims Won"]:Fire()
end
When I reset, it didn't fire the the event. |
|
Dark_YugiJoin Date: 2010-08-26 Post Count: 11036 |
I added the .Humanoid and got the same results. |
|
Dark_YugiJoin Date: 2010-08-26 Post Count: 11036 |
Bump |
|
Dark_YugiJoin Date: 2010-08-26 Post Count: 11036 |
Bump |
|
Dark_YugiJoin Date: 2010-08-26 Post Count: 11036 |
bump |
|
|
Dark_YugiJoin Date: 2010-08-26 Post Count: 11036 |
All my output says when the assassin dies is
19:56:30.873 - Started network server 127.0.0.1|53640
19:56:30.896 - Argument 1 missing or nil
19:56:30.897 - Script 'ServerScriptService.GameScript2', Line 72
19:56:30.898 - Stack End
19:56:30.899 - ServerScriptService.Script:1: attempt to index global 'character' (a nil value)
19:56:30.900 - Stack Begin
19:56:30.900 - Script 'ServerScriptService.Script', Line 1
19:56:30.901 - Stack End
19:56:30.918 - No assetUrl set
19:56:30.919 - Script 'ServerScriptService.Kohl's Admin Commands V2', Line 2436
19:56:30.919 - Stack End
Loading Cutscene Editor...
19:56:31.114 - Successfully opened file - C:/Users/trevo_000/AppData/Local/Roblox/server.rbxl
19:56:36.560 - MarketplaceService:GetProductInfo() productInfoUrl is empty
19:56:36.561 - Script 'ServerScriptService.LuaModelMaker's Admin', Line 546
19:56:36.561 - Stack End
19:56:36.567 - An error occurred
19:56:36.568 - Script 'C:/Users/trevo_000/AppData/Local/Roblox/Plugins/GameInfo.lu', Line 16 - global getAllChildren
19:56:36.568 - Script 'C:/Users/trevo_000/AppData/Local/Roblox/Plugins/GameInfo.lu', Line 18 - global getAllChildren
19:56:36.569 - Script 'C:/Users/trevo_000/AppData/Local/Roblox/Plugins/GameInfo.lu', Line 25 - global getInstanceCount
19:56:36.570 - Script 'C:/Users/trevo_000/AppData/Local/Roblox/Plugins/GameInfo.lu', Line 112
19:56:36.570 - Stack End
19:56:38.954 - New connection from 127.0.0.1|65426
Player -1 added
19:56:40.574 - New connection from 127.0.0.1|65427
Player -2 added
Cutscene Editor Loaded
Hello world!
Hello world!
Hello world!
Assassin is: Player1
Protector is: Player2 |
|