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

Controlling the camera through .focus?

Asked by
RoboFrog 400 Moderation Voter
9 years ago

A long time ago (well, about a year ago) I created a game largely based upon manipulating the camera. I've recently gone back to it, and every bit of the camera angle changes have now broken through some ROBLOX update. I've read back over the wiki, but I can't seem to find the issue. If anybody could offer any insight about where I should go with this, I'd be very grateful.

local controllers = {} 
local keysDown = {} 
local keyDown = false
local mouse = game.Players.LocalPlayer:GetMouse()
local camfoc1 = game.Workspace.LookTo21.Position
local camfoc2 = game.Workspace.Ghost3.Head.Position
local camfoc3 = game.Workspace.LookTo23.Position
local camfoc4 = game.Workspace.LookTo24.Position
local camfoc5 = game.Workspace.LookTo25.Position
local camfoch = game.Workspace.GhostEnd.Head.Position
local camera = workspace.CurrentCamera

print("This is cloned properly") -- This local script gets cloned into the player's PlayerGui properly.

function removeControl()
    repeat wait() until not keyDown 
    for _, controller in pairs(game:GetService("ControllerService"):GetChildren()) do
        controller.Parent = nil 
        table.insert(controllers, controller)
    end
end

function resumeControl()
    for _, controller in pairs(controllers) do
        controller.Parent = game:GetService("ControllerService") 
    end
    controllers = {} 
end

-- From here to the next marked line isn't as important I would assume.
mouse.KeyDown:connect(function(key) 
    keysDown[key:upper()] = true
    keyDown = true
end)

mouse.KeyUp:connect(function(key)
    keysDown[key:upper()] = false 
    local hasKeyDown = false
    for key, isDown in pairs(keysDown) do 
        if (isDown) then
            hasKeyDown = true 
        end
    end
    keyDown = hasKeyDown 
end) 
-- The mark stated prior.

local lplayer = game.Players.LocalPlayer.Character.Humanoid

removeControl()

local angle = 0

game.Workspace.CurrentCamera.Focus=CFrame.new(camfoc1)
wait(.01)

game.Workspace.CurrentCamera.Focus=CFrame.new(camfoc3)
wait(.01)

game.Workspace.CurrentCamera.Focus=CFrame.new(camfoc4)
wait(.01)

game.Workspace.CurrentCamera.Focus=CFrame.new(camfoc5)
wait(.01)

game.Lighting.hall1end.Value = true

for i = 1,100 do
    game.Workspace.CurrentCamera.Focus=CFrame.new(camfoc2)
    wait(.01)
end

resumeControl()
game.Workspace.CurrentCamera.CameraType = "Custom"


If any more information is requested, I'd happily provide it -- I would just love to have this game working again.

Answer this question