Hello, I recently attempted to randomize the players appearance, however it only seems to work if I you the PlayerAdded command. I want to randomize every character's appearance within a table using a function.
In order to make randomization simple I ran multiple tests to see what the population of roblox is, I got values between 16, and 145599999. anything below 16 can give errors because they no longer exist.
So basically this:
game.Players.PlayerAdded:connect(function(Player) Player.CharacterAppearance = "http://www.roblox.com/Asset/CharacterFetch.ashx?userId="..math.random(16, 145599999) end)
the above works fine, but for some reason when I try to incorporate it in a function like this:
function randomizecharacter() for _, player in pairs(game.Players:GetPlayers()) do delay(1, function(player) player.CharacterAppearance = "http://www.roblox.com/Asset/CharacterFetch.ashx?userId="..math.random(16, 145599999) end) end end
It doesn't work at all or give errors.
So how can I randomize players based on a user id value between 16, and 145599999 using a call able function and not only from when the player is added.
Thanks in advance if anyone actually answers this.
You need to call the function; you have not called it you have only declared it. The first time it worked because the function was called when a player was added. I do not understand why you do not want to do it with player added. If it is you want this to randomly occur in the game do player added but on the second line type ~~~~~~~~~~~~~~~~~ wait(math.random(1,60)) ~~~~~~~~~~~~~~~~~