So basically, all i want to do is, look through the length f the players, and then one of those players are Class1, then we get another random player, this time the player is Class 2, the rest of the players which aren't any of the two are Class3. So 1 player is Class1 another("Different") player is Class2 and the rest are basically Class3.

I then want that value signaled back to the script this is called in, so that i can determine which of the players(That i iterate over once again) are class1, class2 and the rest which are classified as class3, then i show them a display based on that. (Sorry for long explanation!)

Thanks in advance!

This is what i got:

local ClassManager = {}

local rndm = math.random()

local classes = { murder, sheriff, inno }

local class = classes[math.random(1,#classes)]

function ClassManager:DisplayClass() 
	for i,v in pairs(game.Players:GetPlayers()) do
local gui = v.PlayerGui:FindFirstChild("ScreenGui")
		local class1disp= gui:FindFirstChild("ClassDisplayiNormal")
		local class2disp= gui:FindFirstChild("ClassDisplayArmed")
		local class3disp= gui:FindFirstChild("ClassDisplayInnocent")
                local class1 = v[math.random(1,#v)]
                local rndPlr = v[math.random(1,#v)]
                if rndPlr == class1 then repeat
                rndPlr = v[math.random(1,#v)]
                until rndPlr ~= class1
                class2 = rndPlr
		if class == classes[1] then
			class1.Visible = true
			print'Plr is class1'
		elseif class == classes[2] then
			print'Plr is class2'
			class2disp.Visible = true
		else class3disp= true
			print'Plr is class3'
			end
		end
         end
end

The thing is, it always shows the class1 display regardless. Anybody, please help! And as an side note, i call this in an Module script that is then called in an Normal Server Script, They are all inside ServerScriptService.

return ClassManager

3 comments

2

put it in a code block please. Its easier to read.

0

I edited the post to use a Lua code block (I put ~~~~ before and after the code)

0

Thanks but, i still kind of need help :(