So I’ve noticed that you can’t animate character models within a ViewPortFrame.
Doing some research, I found a post about updating Motor6D with Transform.
My problem is that my script doesn’t seem to work.
c = Character model in ViewPortFrame proxyAnim = Table containing actual player character’s Motor6 instances
repeat
game:GetService('RunService').RenderStepped:Wait()
for _,v in pairs(proxyAnim) do
c:FindFirstChild(v.Name,true).Transform = v.Transform
end
until dead
I’ve printed both values and it outputs that it’s updating, but the character model in the ViewPortFrame isn’t changing nor are its Motor6 instances. But even changing them manually doesn’t seem to do anything in Studio. Does this no longer work or am I doing something wrong?
If this is no longer possible, I plan on simply updating all of the BasePart CFrames.
Did you attempt to play any animations on the character clone? You can’t just copy the character and hope that the duplicate automatically plays animations matching the actual character.
The gif below was set up using a ViewPortFrame and a WorldModel.
I copied the idle animation from my character in Studio and loaded that directly into the clone’s humanoid and played it. Nothing seems to have happened.
function ang(x,y,z) return CFrame.Angles(math.rad(x),math.rad(y),math.rad(z)) end
local P = game:GetService('Players')
local p = P.LocalPlayer
local port = script.Parent:WaitForChild('Port')
local cam = Instance.new('Camera',script)
local anim = script:WaitForChild('Animation1')
port.CurrentCamera = cam
if not p.Character then p.CharacterAdded:Wait() end
p.Character:WaitForChild('HumanoidRootPart')
wait(1)
local c = Instance.new('Model')
for _,v in pairs(p.Character:GetChildren()) do
if not v:IsA('BaseScript') then
v:Clone().Parent = c
end
end
c.Parent = port:WaitForChild('World')
cam.CFrame = c.HumanoidRootPart.CFrame*ang(0,180,0)*CFrame.new(0,0,5)
local idle = c.Humanoid:LoadAnimation(anim)
idle.Looped = true
idle:Play()
(I know there are some parts that can be improved, but I’m just doing this for testing right now.)
You’re cloning the parts of the character and putting them in a new model - there’s no humanoid to load an animation to. There also wouldn’t be any joints. (Edit: Misread “BaseScript” as “BasePart”)
Set the Archivable property of the actual character to true (it’s false by default) and then you can just call :Clone() on the player’s character.