Hey developers! How are you doing? I hope really really well!
-
What do you want to achieve?
Being direct, to get the same expected result in the repeat until loop but without that error
-
What is the issue?

-
What solutions have you tried so far? Remaking this line of the code but it doesn’t change anything
So the error is specifically in the line 244, but that part of the code is inside a repeat until loop, and what this loop does is that the console picks a random player until the player’s character has the “Dead.Value == false” (StringValue.Value) and he doesn’t haves the “NewPlayer” (StringValue) and the “IntermediumPlayer” inside his character then finish the loop.
Here’s what I mean with that:
repeat
PlayerName1 = game.Players:GetPlayers()[math.random(1, #game.Players:GetPlayers())]
until --the following line is the one that causes the error:
game.Players[PlayerName1].Character:WaitForChild('Dead').Value == false and game.Players[PlayerName1].Character:FindFirstChild('NewPlayer') == nil and game.Players[PlayerName1].Character:FindFirstChild('IntermediumPlayer') == nil
Thank you for everything and have a nice day and life! goodbye!

PlayerName1 gets instance value instead of player name so try doing this instead game.Players:FindFirstChild(PlayerName1.Name).Character:WaitForChild('Dead').Value
2 Likes
game.Players:FindFirstChild(PlayerName1.Name).Character:WaitForChild('Dead').Value == false
and
game.Players:FindFirstChild(PlayerName1.Name).Character:FindFirstChild('NewPlayer').Value == nil and
game.Players:FindFirstChild(PlayerName1.Name).Character:FindFirstChild('IntermediumPlayer').Value == nil
Basically you forgot to call the players name but instead just called the instance. Additionally you also forgot to add .Value after calling the other 2 values inside of the player. This should work.
repeat
PlayerName1 = game.Players:GetPlayers()[math.random(1, #game.Players:GetPlayers())]
until --the following line is the one that causes the error:
game.Players[PlayerName1.Name].Character:WaitForChild('Dead').Value == false and game.Players[PlayerName1.Name].Character:FindFirstChild('NewPlayer') == nil and game.Players[PlayerName1.Name].Character:FindFirstChild('IntermediumPlayer') == nil
I believe they’re setting the player to nil, though I may be wrong.
1 Like
That literally makes no sense “NewPlayer” & “IntermediumPlayer” aren’t values of the character. Very obviously they are string values or some other data type. He didn’t address them as values because he never put .Value. The game will throw an error if he runs it. Additionally the script isn’t setting the values, its pretty self explanatory that the script is simply checking if the values have already been changed. Your code plain out won’t work. All it will do is move the error down an arguement.
1 Like
That’s the solution right there.
Also, the values could be a script or folder, etc… If he put .Value
for one of the values, I don’t believe he’d miss the other 2.
Still bad programming practice regardless. My solution that i proposed included a :FindFirstChild() which would’ve accounted for a sudden player leave. This solution doesn’t account for it so its still a bad solution.