for , character in Seekers do local player = Players:GetPlayerFromCharacter(character)…
- User
for _, character in Seekers do local player = Players:GetPlayerFromCharacter(character) if player then task.wait(1) LocalRemotes.Visual.CharacterCamera:FireClient(player, numSeekers, table.unpack(Seekers)) end end for _, character in HidersFolder:GetChildren() do local player = Players:GetPlayerFromCharacter(character) if player then task.wait(1) LocalRemotes.Visual.CharacterCamera:FireClient(player, numSeekers, table.unpack(Seekers)) end end
combine these two
- Assistant
Certainly! To combine the two loops, you can iterate through both the
Seekerslist and the children of theHidersFolderin a single loop. One way to do this is to use an array and insert both sets of characters into it, then loop over that array.Here is the combined version of the code:
lualocal playersToNotify = {} -- Add Seekers to the list for _, character in ipairs(Seekers) do table.insert(playersToNotify, character) end -- Add Hiders to the list for _, character in ipairs(HidersFolder:GetChildren()) do table.insert(playersToNotify, character) end -- Notify all players for _, character in ipairs(playersToNotify) do local player = Players:GetPlayerFromCharacter(character) if player then task.wait(1) LocalRemotes.Visual.CharacterCamera:FireClient(player, numSeekers, table.unpack(Seekers)) end end