I am trying to use values on players as codes for their roles in a game. I cannot think of a way to randomize the values in the players without some values being the same.
My only attempt:
local numhelp = Instance.new('NumberValue') numhelp.Value = game.Players.NumPlayers for _,v in pairs(game.Players:GetChildren()) do local num = numhelp.Value v.CharType = num numhelp.Value = numhelp.Value - 1 end end
It took me a while to think this up, but it isn't randomized. I need help randomizing the values without alike values. I am trying also to get the randomization numbers to go from 1 to the number of players.
Code Fixed
local numhelp = Instance.new('NumberValue') for _,v in pairs(game.Players:GetChildren()) do if v.numhelp == nil then local Val = Instance.new('NumberValue',v) Val.Value=0 end v.numhelp.Value = math.random(1,game.Players.NumPlayers) v.CharType = numhelp.Value end
math.ranodm(1,4) is the numbers you want it to go to as seen now it will go to a random number between 1 and players in the game. With 1 and players in the game included as a option to be chose!
Hopefully this answer your question as I don't really know what your trying to do here!