Viewportframe, help!

Try this maybe:

local model = someModelHere

local size = model:GetExtentsSize()

local longest = math.max(size.x,size.y,size.z)
local distance = longest*2

camera.CFrame = CFrame.lookAt(model.PrimaryPart.Position+model.PrimaryPart.CFrame.LookVector*distance,model.PrimaryPart.Position)

I think all of this already solves the dummy part, now i just need to make the dummy play the animation, how would i do that now?

Just use local Loaded = Humanoid:LoadAnimation() when you want to load and use Loaded:Play() to play the animation…

1 Like

So, would a normal Animator:LoadAnimation() script work?

1 Like

Yes, because this is like a player character.

1 Like

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.