Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local RolesModule = {}
- local RS = game:GetService("ReplicatedStorage")
- local rolesFolder = Instance.new("Folder", RS) or RS:WaitForChild("Roles")
- rolesFolder.Name = "Roles"
- function RolesModule.AssignRoles()
- local Players = game:GetService("Players")
- local players = Players:GetPlayers()
- local playerCount = #players
- if playerCount < 2 then
- warn("Not enough players to assign both Vampire and Hunter roles.")
- return
- end
- local vampireIndex = math.random(1, playerCount)
- local hunterIndex
- repeat
- hunterIndex = math.random(1, playerCount)
- until hunterIndex ~= vampireIndex
- for i, player in ipairs(players) do
- local role = "Survivor"
- if i == vampireIndex then
- role = "Vampire"
- elseif i == hunterIndex then
- role = "Hunter"
- end
- local roleValue = Instance.new("StringValue")
- roleValue.Name = player.Name
- roleValue.Value = role
- roleValue.Parent = rolesFolder--your folder
- end
- end
- return RolesModule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement