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

Spawn as specific person not working?

Any Reason why when I insert this into Workspace, its not working? Did ROBLOX update something to do with this? Or do it have any wrong coding.

--id= {27691638;62393315} thats how you randomize, you can keep adding too!
id= {62393315} --62393315 default look(Gray)
link= "http://www.roblox.com/Asset/CharacterFetch.ashx?userId="
math.randomseed(tick())
game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(character)
player.CharacterAppearance = (link..id[math.random(1,#id)])
	end)	
end)

1 answer

✓ Accepted answer

Ok, so you have the right basic idea, but you are missing a couple things. To start off, there isn't much of a point in using math.random with only 1 option, so you would need to add another item to the ID list, or just remove the math.random. (I just removed the math.random being as I am not going to change things that aren't needed to be changed)

--id= {27691638;62393315} thats how you randomize, you can keep adding too!
id= {62393315} --62393315 default look(Gray)
link= "http://www.roblox.com/Asset/CharacterFetch.ashx?userId="
math.randomseed(tick()) -- You don't need this if you only have 1 option in the ids

game.Players.PlayerAdded:connect(function(player)
		repeat wait() until player.Character
		player.CharacterAppearance = link..id[1]
		player:LoadCharacter() -- you have to load the new appearance
		print("Id changed")
    end)    

If I have helped answer your question, please remember to accept my answer. Otherwise comment on how I could have better helped you.

3 comments

0

Why can't you use math.random with one option?

0

Maybe it was just roblox, but when I tried it for making something similar it would error when I only had 1 option. I edited the answer. It doesn't change whether or not my answer is correct, so I don't see why downvote.

0

math.random() with a single parameter returns an integer between 1 and that number.

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