Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I move the roblox studio camera with a plugin?

Asked by 4 years ago
Edited 4 years ago

I want to make a plugin that moves the camera in Roblox Studio with a CFrameValue.

It's not throwing me an error, but at the same time the camera won't move where I want it to.

Here's the code:

local toolbar = plugin:CreateToolbar(script.Parent.Name)
local CreateFrame = toolbar:CreateButton("Create A Frame", "Creates a frame", "rbxassetid://64940934")
local SetPosit = toolbar:CreateButton("Play Frame", "Plays a frame", "rbxassetid://3482479506")

local function FrameCreate()
    local cameraframe = workspace.CurrentCamera.CFrame
    local FOV = workspace.Camera.FieldOfView
    local camerafolder = script.Parent.CameraFrame:Clone()

    wait()
    camerafolder.FOV.Value = FOV
    camerafolder.CFrameVal.Value = cameraframe
    camerafolder.Parent = workspace

    print(camerafolder.CFrameVal.Value)
end
CreateFrame.Click:Connect(FrameCreate)

local function SetPosition()
    local cameraframe = workspace.CurrentCamera.CFrame
    local getstuff = workspace:GetChildren()

    for i,v in pairs(getstuff) do
        if v:IsA("Folder") then
            local stringname = "Camera"
            if string.find(v.Name, stringname) then
                cameraframe = Vector3.new(v.CFrameVal.Value)
            end
        end
    end

--  workspace.Camera.FieldOfView = selection.FOV.Value
end
SetPosit.Click:Connect(SetPosition)

By the way, I'm using a folder that has the CFrameValue in it.

Thats why I have a IsA("Folder") thing there.

Answer this question