R15 Avatar loader with UserIds. (Refresh Avatar)

Hello, this is my first post in #resources:community-resources;
First, create an r15 dummy
now create a server script and paste this code

Change cooldown with your cooldown change char to your NPC path and if you are using animation change animation to the path for your animation track

Change userId with the userId of the user you want to load the avatar.

With animation:

-- // Copyright 2022, paulocezarnbr, All rights reserved.
	
local userid = 1302709222			
local char = script.Parent:WaitForChild("Loader2")

local humdesc = game:GetService("Players"):GetHumanoidDescriptionFromUserId(userid)

local Animator = char:WaitForChild("Humanoid"):WaitForChild("Animator")

local Animation = game:GetService("ReplicatedStorage"):WaitForChild("Animations"):WaitForChild("Olha a onda")

local AnimationTrack = Animator:LoadAnimation(Animation)

local Cooldown = 60

AnimationTrack.Priority = Enum.AnimationPriority.Action
AnimationTrack.Looped = true

char.Humanoid:ApplyDescription(humdesc)

task.wait()

AnimationTrack:Play()

while task.wait(Cooldown) do
	AnimationTrack = Animator:LoadAnimation(Animation)

	AnimationTrack.Priority = Enum.AnimationPriority.Action
	AnimationTrack.Looped = true

	humdesc = game:GetService("Players"):GetHumanoidDescriptionFromUserId(userid)
	char.Humanoid:ApplyDescription(humdesc)
	char = script.Parent:WaitForChild("Loader2")
	task.wait()
	AnimationTrack:Play()
end

Without Animation:

-- // Copyright 2022, paulocezarnbr, All rights reserved.

local userid = 1302709222			
local char = script.Parent:WaitForChild("Loader2")
local Cooldown = 60
local humdesc = game:GetService("Players"):GetHumanoidDescriptionFromUserId(userid)

char.Humanoid:ApplyDescription(humdesc)

while task.wait(Cooldown) do
	humdesc = game:GetService("Players"):GetHumanoidDescriptionFromUserId(userid)
	char.Humanoid:ApplyDescription(humdesc)
	char = script.Parent:WaitForChild("Loader2")
end


Hope I helped you. :wink:

1 Like