Hey so I found this script online as I was trying to learn how to make it so 1 person is murderer and the rest are innocents, basically it waits (whatevertime) it is set to and then will choose 1 person to be a murderer. but the thing is, it only sets to one time and will keep picking roles. I want to make it wait 22 seconds so it goes 5 seconds into the round and picks a role but then wait 115 seconds for the round to end. does anyone know how to fix this?
just add waits
local killerWeapon = game.ServerStorage.Knife
local plrs = game.Players
local survivors = {}
while wait(22) do
wait(5) --wait 5 seconds into the round
local chosen = plrs:GetPlayers()[math.random(1, #plrs:GetPlayers())]
chosen.PlayerGui.Picker.Background.RoleGiven.Text = "Murderer"
chosen.PlayerGui.Picker.Background.RoleGiven.TextColor3 = Color3.fromRGB(255,0,0)
chosen.PlayerGui.Picker.Background.Visible = true
killerWeapon:Clone().Parent = chosen.Backpack
for i, plr in pairs(plrs:GetPlayers()) do
if plr ~= chosen then
table.insert(survivors, plr)
plr.PlayerGui.Picker.Background.RoleGiven.Text = "Survivor"
plr.PlayerGui.Picker.Background.RoleGiven.TextColor3 = Color3.fromRGB(0,255,0)
plr.PlayerGui.Picker.Background.Visible = true
end
end
wait(115) --wait until end of the round
end
1 Like
thanks knew it had to included waits just didn’t know how to put it so thanks for making it this way!