So I have a global script inside the Workspace, here's what's in it.
for i,v in pairs(game.Players:GetPlayers()) do if v.Character:FindFirstChild("Humanoid") then v.Character.Humanoid.Died:connect(function() v.InGame.Value = false end) end end
I also have a rounds script, that changes that value to true when the round starts, that script also kills the player. It changes the value true, and works 100%.
And I have a script that inserts this value into the player when the start:
game.Players.PlayerAdded:connect(function(p) ing = Instance.new("BoolValue") ing.Name = "InGame" ing.Value = false ing.Parent = p end)
The script that doesn't work, is the first one.
--Edit for ToTo--
for i,v in pairs(game.Players:GetPlayers()) do if v.Character:FindFirstChild("Humanoid") then v.Character.Humanoid.Died:connect(function() v.InGame.Value = 1 end) end end
Values can't be turned into True nor false. Try making the value into numbers. Make it so 1 = false and 0 = true
You have to also use the PlayerAdded event in the first script because as it is now, it only will look through each player once and connect their Humanoid.Died event once. You have to connect Died every time the character respawns.
Game:GetService("Players").PlayerAdded:connect(function(plr) plr.CharacterAdded:connect(function(char) char:WaitForChild("Humanoid").Died:connect(function() plr:FindFirstChild("InGame").Value = false end) end) end)