I am trying to load a players avatar onto a statue, (the statue displays whoever has the most kills in a game) but my problem is that the statue is 2 times as large as the player. so when I try to load the players accessories, they all are in the wrong spot. I made a script to combat this, here it is:
local function HighestPlrSort()
local PList = game.Players:GetPlayers()
local function SortFunc(P1, P2)
return P1.leaderstats["Hit's"].Value > P2.leaderstats["Hit's"].Value
end
table.sort(PList, SortFunc)
return(PList[1])
end
wait(2)
while true do
local Plr = HighestPlrSort()
script.Parent.Humanoid:ApplyDescription(game.Players:GetHumanoidDescriptionFromUserId(Plr.UserId))
for i, v in ipairs(script.Parent:GetDescendants()) do
if v:IsA("Pants") or v:IsA("Shirt") or v:IsA("Decal") or v:IsA("ShirtGraphic") then
v:Destroy()
elseif v:IsA("BasePart") then
v.Color = Color3.new(0.27451, 0.290196, 0.270588)
elseif v:IsA("SpecialMesh") and v.Parent.Name ~= "Head" then
v.TextureId = ""
v.Scale = Vector3.new(2, 2, 2)
for i, Attach in ipairs(v.Parent:GetChildren()) do
if Attach:IsA("Attachment") then
local VectorFromAttach = Attach.Position
Attach.Position = VectorFromAttach + VectorFromAttach
end
end
end
end
wait(60)
end
the problem Im having is that sometimes the script works…
but other times, odd things happen.
anyone know what is wrong with my script? how can I make ALL players work with my statue? thanks in advance!