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

I can't get the character's avatar appearance to change?

Asked by 4 years ago
Edited 4 years ago
local sss = game:GetService("ServerStorage")

local customs = sss.customs

local tablechr = {}

for i, v in pairs(customs:GetChildren()) do
    table.insert(tablechr,1,v)
end

local chosenchr = tablechr[math.random(1, #tablechr)]


game.Players.PlayerAdded:Connect(function(plr)
    plr.CharacterAdded:Connect(function(chr)
        print(chr)      
        chr = chosenchr
    end)
end)

Above is basically just a script that gets the children (the character models) of a folder called customs. I then stored a randomised one out of those children in a variable. I then tried to set the character of the player joining equal to the new character (the variable chosenchr), but it doesn't work. Any help would be appreciated. (:

0
Is the script a localscript? Anything in the Output? Hydrogyn 155 — 4y
0
it's just a normal server script that I put in the ServerScriptService Galvaric 39 — 4y
0
And no, nothing is displayed in the output. Galvaric 39 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

I don't want to misunderstand the default code of yours, so I carefully changed it a little bit.

--Set the player's default char to this
game.Players.PlayerAdded:Connect(function(plr)
    plr.Character = chosenchr
end)

If it is not the same idea as what you said, I will change it until you provide any further details.

0
That doesn't work either sadly. Even then, I appreciate the help. Galvaric 39 — 4y
0
Ohh, maybe check other scripts. Because it works fine for me. LinavolicaDev 570 — 4y
Ad

Answer this question