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)
Faczki
(Faczki)
April 30, 2021, 2:39pm
#23
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
Faczki
(Faczki)
April 30, 2021, 2:41pm
#25
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.
Faczki
(Faczki)
April 30, 2021, 2:43pm
#28
I’ll try it out and tell you back, thanks for all the help.
1 Like
Faczki
(Faczki)
April 30, 2021, 2:49pm
#30
RobloxGamerPro200007:
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 char = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()
char.Archivable = true
for _, object in pairs(char:GetDescendants()) do
object.Archivable = true
end
local clone = char:Clone()
for _, object in pairs(char:GetDescendants()) do
object.Archivable = false
end
char.Archivable = false
clone.Parent = viewportFrame
local viewportCamera = Instance.new("Camera")
viewportFrame.CurrentCamera = viewportCamera
viewportCamera.Parent = viewportFrame
viewportCamera.CFrame = CFrame.new(Vector3.new(20, 20, 20), clone.HumanoidRootPart.Position)
It does not work, i get this error:
Add wait
??
local char = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()
wait(0.2)
Faczki
(Faczki)
April 30, 2021, 2:59pm
#32
@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:
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
Faczki
(Faczki)
April 30, 2021, 3:03pm
#34
I’ll try adding one manually, because i tried Humanoid:LoadAnimation()
and it did not work.
Faczki
(Faczki)
April 30, 2021, 3:04pm
#35
Ok, it also did not work. I don’t have any ideas left too
flkfv
(flkfv)
April 30, 2021, 3:06pm
#36
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
Faczki
(Faczki)
April 30, 2021, 3:08pm
#38
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()
Faczki
(Faczki)
April 30, 2021, 3:08pm
#40
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
That’s very weird!
Let me try your code.