So, I am trying to make something to where it will show the object in the target value. I have the value already set, and everything, but the view port frame showing the object does not work, there are no errors, here's what I did.
local target = script.Parent:WaitForChild("Target")
while wait(5) do
local camera = workspace:FindFirstChild(target.Value.Name.."Camera")
local object = script.Parent.FocusedObject:FindFirstChild(target.Value.Name)
if not camera then
print("No camera found.")
else
camera:Destroy()
print("Destroyed existing camera.")
end
if not object then
print("No object found.")
else
object:Destroy()
print("Found object, destroying now.")
end
script.Parent.ObjectClass.Text = target.Value.ObjectClass.Value
script.Parent.ObjectName.Text = target.Value.Name
script.Parent.ObjectDescription.Text = target.Value.ObjectDescription.Value
camera = Instance.new("Camera",workspace)
camera.CFrame = CFrame.new(target.Value.HumanoidRootPart.Position + {target.Value.HumanoidRootPart.CFrame.lookVector*5}+ Vector3.new(2,2,2),target.Value.HumanoidRootPart.Position)
camera.Name = target.Value.Name.."Camera"
script.Parent.FocusedObject.CurrentCamera = camera
local newObject = target.Value:Clone()
newObject.Parent = script.Parent.FocusedObject
end
