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.
Faczki
(Faczki)
April 30, 2021, 3:21pm
#42
So, did you figure it out or something?
I found a forum post that may help you:
Animation on ViewportFrame
Faczki
(Faczki)
April 30, 2021, 3:29pm
#44
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.
1 Like
Doing that is not effective since it isn’t always there after 0.2 seconds.