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

Semi Locked Camera?

Asked by 8 years ago

Hi guys, I have a semi locked script that glitches up cameras. I'm going for a FN@F game. Here's the semi locked camera script

--[[
    this script takes away a little control over the camera. instead of
        freely looking around, the camera will stare at a point but will
        have the ability to look around a little bit to follow the mouse
        cursor. great for cutscenes or games with static players !!!!

                                                            enjoy!! ~oozle :)
--]]

wait()

--this is the max angle that the camera can look left/right/up/down at any given time
local lookaround = 20
lookaround = math.rad(lookaround)

--objects
local player = game.Players.LocalPlayer
local cam = workspace.CurrentCamera
repeat wait() until workspace:findFirstChild(player.Name)
wait() --wait a little bit for stuff to load
local mouse = player:GetMouse()
local subject = player.Character.Head

--measure screen dimensions
local measure = Instance.new("ScreenGui",player.PlayerGui)
repeat wait() until measure.AbsoluteSize.X ~= 0
wait(1) --wait a little bit for the absolutesize to update
local screensizex = measure.AbsoluteSize.X
local screensizey = measure.AbsoluteSize.Y
measure:Destroy()

--restrict the camera
cam.CameraType = Enum.CameraType.Scriptable

--give it a little freedom though
while true and wait() and player.Character.Humanoid.Health ~= 0 and subject do
    cam.CoordinateFrame = subject.CFrame * CFrame.Angles(lookaround*(((screensizey/2)-mouse.Y)/screensizey)*2,lookaround*(((screensizex/2)-mouse.X)/screensizex)*2,0)
end

cam.CameraType = Enum.CameraType.Custom

Here's a camera

local CameraRotateScript=script;
local Camera=CameraRotateScript.Parent;
while true do
for RotateRight=1,100 do
Camera.CFrame=Camera.CFrame*CFrame.fromEulerAnglesXYZ(0,math.rad(-0.5),0)
wait(0)
end
wait(2)
for RotateLeft=1,100 do
Camera.CFrame=Camera.CFrame*CFrame.fromEulerAnglesXYZ(0,math.rad(0.5),0)
wait(0)
end
wait(2)
end


Please help. Thanks!

0
Please edit this post, highlight the script, and hit the Lua button. Validark 1580 — 8y
0
Programmatic code please? KenzaXI 166 — 8y
0
there LoneWatermelon 0 — 8y

Answer this question