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

This isn't working correctly, help?

appear = {"http://www.roblox.com/Asset/CharacterFetch.ashx?userId=23749623","http://www.roblox.com/Asset/CharacterFetch.ashx?userId=17199995","http://www.roblox.com/Asset/CharacterFetch.ashx?userId=56449"}
game.Players.PlayerAdded:connect(function(Player)
local set = appear[math.random(3)]
Player.CharacterAppearance = set
end)

Hello there, yesterday I tried to work on a script that I was trying to make, what this script does is that when a player joins it randomizes his appearance, unfortunately this script isn't working correctly, I hosted a test server with 5 players and four changed to the same appearance and only one changed to a different appearance, can somebody please tell me whats wrong?

1 answer

I believe you got that random wrong. You want to choose a random key from the table. The code below should work.

appear = {"http://www.roblox.com/Asset/CharacterFetch.ashx?userId=23749623","http://www.roblox.com/Asset/CharacterFetch.ashx?userId=17199995","http://www.roblox.com/Asset/CharacterFetch.ashx?userId=56449"}

game.Players.PlayerAdded:connect(function(Player)
local set = appear[math.random(1,#appear)]
Player.CharacterAppearance = set
end)
 

Don't forget to accept this as the answer!

2 comments

0

it's still the same :(

0

What's the error?

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