Hey there, I’m currently making a game like Town Of Salem, for those of you who don’t know it, it’s a social deduction role based game. Here’s the issue I’m running into, In TOS, when the night time phase is over, It gathers all the results of what everyone chose to do for the night and computed it, I thought I had a good system going, this is how I was doing it
for i,v in pairs(game.Players:GetPlayers()) do
if v.PlayerData.RoleBlocked.Value ~= true then
if v.PlayerData.Role.Value == "Veteran" then
--do the role stuff
end
if v.PlayerData.Role.Value == "Sheriff" then
--do the role stuff
end
if v.PlayerData.Role.Value == "Escort" then
--do the role stuff
end
end
end
This was working quite well, the issue that I ran into though, was the fact that since it’s a for loop of the players, Whoevers first in players, will have their role go first, The issue with this is that there are VERY many different priority levels for each role, For example Veteran > Escort > Bodyguard > Godfather
The issue I’m dealing with is that if Player 2 is a veteran, and player 1 is an escort Player 1 will go first because that’s just how the loop is set up. I was thinking about instead of for i,v in pairs(game.Players:GetPlayers()) I could like, Make a priority for each role, and do it like that, But the issue is there are SO many roles, And SO many different priorities, Does anyone know some way that I could do it how I currently have it set up, IE, through having what role I want to go first first, then the next one so on so forth, but have it so that it goes through role priority and not player priority, I know that’s confusing but if anyone understands what Im saying and can help It’d be greatly appreciated.