Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

it only chooses one person..even in a server with 4?

this is only half of the script its a 100+ line script but i didnt want to post the whole thing so this is the part i feel is doing the problems

		function selectCharacter(person)		
	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 = "TagIt"
		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

function calculate(char)
	local characters = char:GetChildren()
	select = (#characters/5)-((#characters/5)%-1)
	for i = 1,select do
		selectCharacter(characters)
		itcount = itcount + 1
	end
end

3 comments

0

What are you trying to accomplish? What happens instead?

0

well its suppose to choose taggers..but every round its choosing one person each time even in a server of 4 people and some time its the same person

0

i updated it. but i dont want it to chosoe only one person all the time so what do i change?

1 answer

Okay, I will try helping you as best I can on my phone. a tip is instead of keep using if then statements try using if then and or it cuts back line count alot.

Okay I will just make you a script drawing players


function draw(players)
max = math.random(1,#players)
for i, v in pairs(players) do
If i >=max then
--blah blah blah
end
end
end

function cut()
for i,v in pairs(game.Players:GetChildren()) do
tabplayers = {}
if v ~= nil and v:FindFirstChild("Character") ~= nil then -- variables just use and 
table.Add(tabplayers,tabplayers[#tabplayers+1],v)
end
draw(tabplayers)
end

This should work but i typed on my iphone so if it doesnt post the errors and il fix it

1 comment

0

dont work

This discussion is preserved as it was. New answers, comments, and votes are closed.