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?
Use the 'Died' Event. Link to: Died (Event) - Roblox Wiki
Line 1 of code edited.
AssassinPlayer = Assassin.Character AssasinPlayer:WaitForChild("Humanoid").Died:connect(function() game.ServerStorage["Victims Won"]:Fire() end)