Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How can I randomize a players appearance with a call-able function?

Asked by 8 years ago

Hello,

I am trying to make a function that randomizes players appearance when called. How would I go about doing this, my first thought would to use randomized player.userId's in the place of this:

game.Players.PlayerAdded:connect(function(Player)
    Player.CharacterAppearance = "http://www.roblox.com/Asset/CharacterFetch.ashx?userId=math.random(16, 145599999" 
end)

If your wondering where I got my math.random numbers, I recently calculated the Roblox population as of 7/22/16 around 11 there were 145599999 players registered to Roblox. anything below 16 could give an error because there are missing player slots for 6,7,8,9,10 etc...

I got the above function to work, but when I turn it into a callable function, and try to call it, it doesn't work. I also noticed that the above function only works when the player joins the game and not if they respawn.

So how can I randomize a character's appearance with a callable function. We don't need to use the method above, if there is an easier or more clean way I'd rather go with that. So whats going on, how can I do this?

Thanks in advance,

--Deka

1 answer

Log in to vote
0
Answered by 8 years ago

Well, the best way to do this is:

local appearance = math.random(16, 145599999)

game.Players.PlayerAdded:connect(function(Player)
    Player.CharacterAppearance = "http://assetgame.roblox.com/Asset/CharacterFetch.ashx?userId="..appearance.."&placeId=YOURPLACEID"
end)

I dont really recommend doing this though, unless you really want to. Cause most id's are the "newest player" id.

0
Do you have a better way? Dekadrachm 50 — 8y
0
Not exactly, I just dont think you should be math.randoming the id's. ObscureIllusion 352 — 8y
0
Also, this sint what I had in mind, I wanted to call the function without using players added Dekadrachm 50 — 8y
0
Well when did you want to call the function? ObscureIllusion 352 — 8y
Ad

Answer this question