How to make rig look like local player on client side only?

I’m trying to make a rig look like the local player in a certain position while playing an animation, but nothing seems to work. In this script, I’m using GetHumanoidDescriptionFromUserId and cloning a rig but then the position changes and the animation doesn’t play. I’ve tried using remote events but those didn’t seem to work and I’ve tried changing the position through the script but there was no option for that.Here are my scripts and hierarchies:

local Player = game.Players.LocalPlayer
local AvatarRig = game:GetService("ReplicatedStorage").AvatarRig:Clone()
AvatarRig.Parent = game.Workspace
AvatarRig.Humanoid:ApplyDescription(game.Players:GetHumanoidDescriptionFromUserId(Player.UserId))

Animation script:

local animator = script.Parent.Humanoid:FindFirstChild("Animator")

if animator then
local animtrack = animator:LoadAnimation(script.Idle)
animtrack:Play()
return animtrack
end

image

image

1 Like

I tried with your script, just added a few lines to fit my test, it works as expected:
(my own avatar is spawned and dancing above me)

local Player = game.Players.LocalPlayer
local AvatarRig = game:GetService("ReplicatedStorage").AvatarRig:Clone()
AvatarRig.HumanoidRootPart.CFrame = Player.Character:WaitForChild("HumanoidRootPart").CFrame * CFrame.new(0,10,0)
AvatarRig.Parent = game.Workspace
AvatarRig.Humanoid:ApplyDescription(game.Players:GetHumanoidDescriptionFromUserId(Player.UserId))
local animator = AvatarRig.Humanoid:FindFirstChild("Animator")

if animator then
	local animtrack = animator:LoadAnimation(script.Animation2)
	animtrack:Play()
	return animtrack
else
	warn("no animator found")
end

Its only one script in CharacterScripts, idk if you have 2 different scripts for the task

1 Like

Hey, thanks for your reply! I have a separate script inside the rig to perform the animation but I can add it inside this one. The problem is, I need the rig to spawn at a specific location, not somewhere by my character.

What specific position? you have coordinates? its a part? Just on this line set the CFrame coordinates you need:
AvatarRig.HumanoidRootPart.CFrame = CFrame.new(0, 0, 0)

1 Like

The thing is, I need to set the position of the actual model. The only reason I need to do this is because the cloned version moves (up i think) for some reason so when i play test I can see its value isn’t the same as the avatarrig in replicated storage. I could try setting the CFrame to

game:GetService(“ReplicatedStorage”).AvatarRig.HumanoidRootPart

but I’m not sure how that will work out, I’ll have to try it later as I do not have access to a computer right now. Also, just to double check: this would only make the client see their own avatar, right?