ViewportFrame error

Trying to make a viewport frame, for some odd reason it is not working. Do you know why? Is there some proprety i need to change?

All i had to do is anchor it, it kept on falling. Careless errors.

1 Like

on what line is the error???

1 Like

It says in line 21, in the output

that is what line???

Level:SetPrimaryPartCFrame(CFrame.new(ViewPortPoint))

its line 17 my bad

and what is level, is it model? because if not, you cant use :setPrimaryPartCFrame

1 Like

You can’t use SetPrimaryPartCFrame on a mesh part. You need to do: Level.CFrame = CFrame.new(viewportPoint)

2 Likes

i get a new error:

08:27:04.029 - GetBoundingBox is not a valid member of MeshPart

08:27:04.030 - Stack Begin

08:27:04.030 - Script ‘Players.ElectronicDroid.PlayerGui.PlayScreen.Screen.Frame.LocalScript’, Line 23

08:27:04.031 - Stack End

Do you intend to work with a MeshPart, or did you want to work with a Model?

1 Like

Well theres a model, which that meshpart is inside that model. They are both called LevelPart, i did something by renaming the other meshparts that are not inside a model, to levelpart2, and levelpart3. Now i get no errors but the viewport frame does not work. I want to work with a model.

Then I assume you meant to do: local Level = workspace:WaitForChild("LevelPart"), if you wanted to get the model.

Would you post the error?

1 Like

Set view port frame like this :

   local target = workspace.target
                    local player = game:GetService("Players").LocalPlayer
            
        	         local camera = workspace.CurrentCamera 
        camera.CameraType = Enum.CameraType.Scriptable
        		 camera.CameraSubject = target 
        	      camera.CFrame = target.CFrame  
        	       camera.FieldOfView = 46     
                camera:WorldToViewportPoint(target.CFrame)
1 Like

I already did:

local level = workspace:WaitForChild("LevelPart")

There now is an error, so here it is:

08:40:54.994 - CFrame is not a valid member of Model

08:40:54.994 - Stack Begin

08:40:54.994 - Script ‘Players.ElectronicDroid.PlayerGui.PlayScreen.Screen.Frame.LocalScript’, Line 17

08:40:54.995 - Stack End

This is the line erroring out.

Level.CFrame = CFrame.new(ViewPortPoint)

This time you have to change it back to SetPrimaryCFrame

Level:SetPrimaryPartCFrame(CFrame.new(ViewPortPoint))

1 Like

new error:

08:53:22.507 - Players.ElectronicDroid.PlayerGui.PlayScreen.Screen.Frame.LocalScript:31: bad argument #2 (Vector3 expected, got Object)

08:53:22.508 - Stack Begin

08:53:22.508 - Script ‘Players.ElectronicDroid.PlayerGui.PlayScreen.Screen.Frame.LocalScript’, Line 31

08:53:22.509 - Stack End

and the line is

ViewportCamera.CFrame = CFrame.Angles(0,math.rad(R),0) * CFrame.new(ViewPortPoint + Vector3.new(0,0,CurrentDistance),ViewPortFrame)

I assume you meant to do:

ViewportCamera.CFrame = CFrame.Angles(0,math.rad(R),0) * CFrame.new(ViewPortPoint + Vector3.new(0,0,CurrentDistance),ViewPortPoint)
1 Like

Did that, it doesnt show up, and i get no errors

Have you checked the entire setup? Is the model anchored, is the viewportframe visible, etc.

1 Like

Just checked, and now it works! Tysm. I should have though of that earlier. careless errors lol