hello, i’m working on a mirror in my game, and for some reason it is not letting me use game.Players.LocalPlayer.Character
my code is:
local vp = script.Parent.ViewportFrame
local cm = workspace:WaitForChild("CamModel")
repeat wait() until cm:WaitForChild("CamPart")
wait(1)
local cam = Instance.new("Camera")
cam.CFrame = cm.CamPart.CFrame
cam.FieldOfView = 40
cam.Parent = script
vp.CurrentCamera = cam
cm.CamPart:GetPropertyChangedSignal("CFrame"):Connect(function()
cam.CFrame = cm.CamPart.CFrame
end)
function RenderPlayer()
local char = game.Players.LocalPlayer.Character:Clone()
print(char)
char.Parent = vp.Plr
end
wait(3)
while wait(.1) do
vp.Plr:ClearAllChildren()
RenderPlayer()
end
and each time i try to use this, i get this error:
Is the property “Archivable” enabled on the character? if not enable it.
Archivable just determines if an object can be saved when publishing your game or cloned with the “Instance:Clone()” method as specified by the docs.
This property determines whether an object should be included when the game is published or saved, or when Instance:Clone() is called on one of the object’s ancestors
I think its the issue because if it was enabled you could easiely clone the character
in your case it printed nil
try this fix:
local vp = script.Parent.ViewportFrame
local players=game:GetService("Players")
local lplr=players.LocalPlayer
local cm = workspace:WaitForChild("CamModel")
repeat task.wait() until cm:WaitForChild("CamPart")
task.wait(1)
local cam = Instance.new("Camera")
cam.CFrame = cm.CamPart.CFrame
cam.FieldOfView = 40
cam.Parent = script
vp.CurrentCamera = cam
cm.CamPart:GetPropertyChangedSignal("CFrame"):Connect(function()
cam.CFrame = cm.CamPart.CFrame
end)
function RenderPlayer()
if lplr.Character==nil then
return
end
lplr.Character.Archivable=true
for i,v in lplr.Character:GetDescendants() do
v.Archivable=true
end
local char = lplr.Character:Clone()
print(char)
char.Parent = vp.Plr
end
task.wait(3)
while task.wait(.1) do
vp.Plr:ClearAllChildren()
RenderPlayer()
end