Hi. I want to make a camera show models in viewportframe
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local infotower = script.Parent.Frame
local cam = Instance.new("Camera")
cam.CameraType = Enum.CameraType.Scriptable
infotower.ViewportFrame.CurrentCamera = cam
cam.Parent = infotower.ViewportFrame
wait(2)
--for i,v in pairs(ReplicatedStorage.Folder:GetChildren()) do
local tower = ReplicatedStorage.Folder.Minigunner:Clone()
tower.Parent = infotower.ViewportFrame.WorldModel
tower.PrimaryPart.Position = Vector3.new(0,0,2)
cam.CFrame = CFrame.lookAt((tower.PrimaryPart.Position+Vector3.new(-4, 0, 0)), tower.PrimaryPart.Position)
local a = tower:FindFirstChild("Animations")
if a then
if a:FindFirstChild("Idle") then
local anim = tower.Humanoid.Animator:LoadAnimation(a.Idle)
anim.Looped = true
anim:Play()
end
end
wait(3)
--end
There is no bugs. but camera doesnt change it just stays in the starting position
i can see the model so the problem has to be with camera