Viewportframe, help!

Well, cloning a character isn’t that easy as you think. I don’t really have any ideas on doing it since I have tried it in the past and didn’t work. The thing I know is that you should turn Archivable property to true before cloning.

I would also give cloned character a ForceField and disable name and health displaying too.

I’ll try it out and tell you back, thanks for all the help.

1 Like

Try to use this script!!

Tell me if this works

It does not work, i get this error:

image

Add wait??

local char = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()
wait(0.2)

@DanilochRBX

This is the script i used:

local viewportFrame = Instance.new("ViewportFrame")
viewportFrame.Size = UDim2.new(0.3, 0, 0.4, 0)
viewportFrame.Position = UDim2.new(0, 15, 0, 15)
viewportFrame.BackgroundColor3 = Color3.new(0.196078, 0.196078, 0.196078)
viewportFrame.BorderSizePixel = 0
viewportFrame.Parent = script.Parent

local Character = game.ReplicatedStorage.Dummy
local clone = Character:Clone()
clone.Parent = viewportFrame

local viewportCamera = Instance.new("Camera")
viewportFrame.CurrentCamera = viewportCamera
viewportCamera.Parent = viewportFrame

viewportCamera.CFrame = CFrame.new(Vector3.new(0, 6, 6), clone.HumanoidRootPart.Position)

local humanoid = clone.Humanoid
local animation = script.Parent:WaitForChild("Animation")
local loadAnim = humanoid.Animator:LoadAnimation(animation)
loadAnim:Play()

And the error i got:

image

That’s because the Dummy doesn’t have an Animator (AnimationController) inside of his Humanoid.
If you want you can add one. I’m not sure if this will work if you add one AnimationController inside of the Humanoid, but you can try it.
If it doesn’t work you can use Humanoid:LoadAnimation()

1 Like

I’ll try adding one manually, because i tried Humanoid:LoadAnimation() and it did not work.

Ok, it also did not work. I don’t have any ideas left too

local viewportFrame = Instance.new("ViewportFrame")
viewportFrame.Size = UDim2.new(0.3, 0, 0.4, 0)
viewportFrame.Position = UDim2.new(0, 15, 0, 15)
viewportFrame.BackgroundColor3 = Color3.new(0.196078, 0.196078, 0.196078)
viewportFrame.BorderSizePixel = 0
viewportFrame.Parent = script.Parent

local Character = game.ReplicatedStorage.Dummy
local clone = Character:Clone()
clone.Parent = viewportFrame

local viewportCamera = Instance.new("Camera")
viewportFrame.CurrentCamera = viewportCamera
viewportCamera.Parent = viewportFrame

viewportCamera.CFrame = CFrame.new(Vector3.new(0, 6, 6), clone.HumanoidRootPart.Position)

local humanoid = clone.Humanoid
local animation = script.Parent:WaitForChild("Animation")

if not humanoid:FindFirstChild('Animator') then
Instance.new('Animator', humanoid)
end

local loadAnim = humanoid.Animator:LoadAnimation(animation)
loadAnim:Play()

Maybe that’s because the dummy parts are Anchored. Try selecting all the parts > go to properties > and disable anchored.

1 Like

No, they are all unanchored, i’ve checked that already

Could you send me your code?
I just tried in my game and it worked.
That was my code:

local Loaded = script.Parent:LoadAnimation(script.Animation)
Loaded:Play()
local viewportFrame = Instance.new("ViewportFrame")
viewportFrame.Size = UDim2.new(0.3, 0, 0.4, 0)
viewportFrame.Position = UDim2.new(0, 15, 0, 15)
viewportFrame.BackgroundColor3 = Color3.new(0.196078, 0.196078, 0.196078)
viewportFrame.BorderSizePixel = 0
viewportFrame.Parent = script.Parent

local Character = game.ReplicatedStorage.Dummy
local clone = Character:Clone()
clone.Parent = viewportFrame

local viewportCamera = Instance.new("Camera")
viewportFrame.CurrentCamera = viewportCamera
viewportCamera.Parent = viewportFrame

viewportCamera.CFrame = CFrame.new(Vector3.new(0, 6, 6), clone.HumanoidRootPart.Position)

local humanoid = clone.Humanoid
local animation = script.Parent:WaitForChild("Animation")
local loadAnim = humanoid.Animator:LoadAnimation(animation)
loadAnim:Play()

Hmmm :thinking:
That’s very weird!
Let me try your code.

So, did you figure it out or something?

I found a forum post that may help you:
Animation on ViewportFrame

That really helps theorycally, i understood what it’s done.

The thing is the code was basically another language for me and i don’t know how i would update it from that to what i need.

Do you have any ideas how i can update that code, or another code (because i think you’ve done a code that worked)

I never used Viewport Frames in my game, and this code is pretty hard for me.
I sincerely don’t understood the code, and I don’t know what we could do. :frowning:

1 Like

Doing that is not effective since it isn’t always there after 0.2 seconds.