Every time I run through my code the function does not continue passed the first if statement. Even when players has values it still won't continue. I have even tried changing
players
to
players[1]
Here's the code:
playersService = game:GetService("Players") ServerScript = game:GetService("ServerScriptService") function testPlayerDeath() local players = playersService:GetChildren() if players == not nil then print("if done") for _, players in pairs(players) do script.ChildAdded:connect(function() print("passed") if script:FindFirstChild(players.Name) == players.Name then print("passed2") local Value = script:WaitForChild(players) if Value.Value == true then print("passed3") print("Current Selection: "..players) onPlayerDeath(players) failed = false return failed else failed = true return failed end end end) end else failed = true return failed end end while true do wait() testPlayerDeath() print("failed?: ") print(failed) end
if you find anything confusing or wrong in my code please leave a comment.
edit: the use of the return is simply for debugging
Even when corrected, the first if statement has no purpose being there. Checking if a player exists, even though you're referencing it directly from the PlayerService, is useless.