Currently, I have a script that adds a value called "InGame" to the player once they join, with the value as false. Once layers are teleported to the map, I run this (In a module script):
function module:CollectPlayers()
for _, Player in pairs ( game.Players:GetPlayers()) do
table.insert(module.Playing, Player)
end
return module.Playing
end
for i, player in pairs(players) do
if player then
character = player.Character
if character then
--I run some other unimportant code here...
player:FindFirstChild("InGame").Value = true
end
end
end
end
Outside of the module script, I also have this:
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
character.Humanoid.Died:Connect(function()
player:WaitForChild("InGame").Value = false
player:LoadCharacter()
end)
end)
end)
Thi sis quite messy, as it is spread out across three scripts. I was thinking of just putting a while true do loop that constantly checks to see if a player has a morph in them (In the game they get morphed into tornadoes) then set their value based on that, but there still has to be a more efficient way to do things. Any suggestions?
