I need help how can I make this script only choose one person and not like 3 or 4 . Code:
function selectCharacter(person) --XD this got a wee-bit confusing! local chosen = person[math.random(1,#person)] if string.find(tagger.Value,chosen.Name) == nil then if chosen:findFirstChild("ItStatus") ~= nil then chosen:findFirstChild("ItStatus").Value = true end if chosen:findFirstChild("leaderstats") ~= nil then chosen:findFirstChild("leaderstats").Value = 0 end local hum = chosen.Character:findFirstChild("Humanoid") if hum ~= nil then hum.WalkSpeed = 20 end local parts = chosen.Character:GetChildren() for i = 1,#parts do if parts[i].className == "Part" then parts[i].Anchored = false end end wait() local tagscript = chosen.Character:findFirstChild("Torso"):findFirstChild("TagFlee") if tagscript ~= nil then tagscript.Name = "Murderer" end local tagblock = chosen.Character:findFirstChild("TagBlock") if tagblock ~= nil then tagblock.Parent = nil end dubHat(chosen) tagger.Value = tagger.Value..", "..chosen.Name else selectCharacter(person) end end
To choose one person in the game randomly:
game.Players:GetPlayers()[math.random(1,game.Players.NumPlayers)]
Based on your selectCharacter
function, it would take game.Players:GetPlayers() as the person
argument, but since that is a constant reference (unless you intend to exclude some players from being chosen) you can just define it in the function instead of passing it to the function every time you call it.