I have a local script in order to show the animated face of the player in a UI.
avatar
is the ViewportFrame instance, WorldModel
is a child of avatar
. So I put the character model under WorldModel
then I create a new Instance of Camera
parented to avatar
. The script will work in Studio however if I join the published game a strange error occur in Animate default script inside the character.
-- [...]
local function SetAnimatedAvatar()
local characterModel = playersService:CreateHumanoidModelFromUserId(localPlayer.UserId)
characterModel.Parent = avatar.WorldModel
local camera = Instance.new("Camera", avatar)
avatar.CurrentCamera = camera
avatar.CurrentCamera.CFrame = CFrame.new(characterModel.Head.Position - Vector3.new(0, 0, 3)) * CFrame.Angles(0, math.rad(180), 0)
end
-- [...]