Im trying to clone over the players character to the viewport frame, but for some reason nothing is working. The animations, and changing its humanoid state to the players actual character state to copy there movement doesn’t work. So im wondering if phyisics dont run in Viewport Frames? Im trying to replicate the world but another issue is when you go in first person the world doesn’t match up. Any help would be great! <3
Code:
local viewportFrame = script.Parent.ViewportFrame
local camera = workspace.Camera:Clone()
camera.Parent = viewportFrame
viewportFrame.CurrentCamera = camera
function cloneCharacter(character)
character.Archivable = true
local fake = character:Clone()
character.Archivable = false
return fake
end
local model = Instance.new("Model", viewportFrame)
for _, object in ipairs(game.Workspace.World:GetChildren()) do
if object:IsA("Instance") then
object:Clone().Parent = model
end
end
repeat wait()
until game.Players.LocalPlayer.Character
local character = cloneCharacter(game.Players.LocalPlayer.Character)
character.Parent = model
local animate = script.Animate:Clone()
if character:FindFirstChild("Animate") then
for _, object in pairs(character:FindFirstChild("Animate"):GetChildren()) do
object:Clone().Parent = animate
end
character:FindFirstChild("Animate"):Destroy()
end
animate.Parent = character
animate.Disabled = false
game.Players.LocalPlayer.Character.Humanoid.StateChanged:Connect(function()
print(game.Players.LocalPlayer.Character.Humanoid:GetState())
end)
game:GetService("RunService").RenderStepped:Connect(function()
camera.CFrame = workspace.Camera.CFrame + Vector3.new(6,0,0)
end)