ViewportFrame Wont Follow Part

  1. What do you want to achieve? Keep it simple and clear!
    The viewport frame should always be on the monsters head. but its frozen mid air

  2. What is the issue? Include screenshots / videos if possible!
    The camera stays in the air for some reason

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    Devfourms

Code:

local gui = script.Parent
local viewportCamera = Instance.new("Camera")
viewportCamera.CFrame = workspace:WaitForChild("Monster", 30):FindFirstChild("Head").CFrame
viewportCamera.FieldOfView = 80

gui.ViewportFrame.CurrentCamera = viewportCamera

local detectZone: BasePart = workspace.DetectPart

while task.wait(0.5) do
	gui.ViewportFrame:ClearAllChildren()
	gui.ViewportFrame.CurrentCamera = viewportCamera
	local parts = workspace:GetPartBoundsInBox(detectZone.CFrame, detectZone.Size)
	for _, part in parts do
		local clone = part:Clone()
		clone.Parent = gui.ViewportFrame
	end
end

Video:

1 Like

fixed it nvm

ertgrgherter5tchars

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.