local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local head = char:WaitForChild("Head")
local ts = game:GetService("TweenService")
local cam = workspace.CurrentCamera
local uis = game:GetService("UserInputService")
uis.InputBegan:Connect(function(input,ispooping)
if ispooping then return end
if input.KeyCode == Enum.KeyCode.E then
cam.CameraType = "Scriptable"
cam.CFrame = head.CFrame
end
end)
local Valid = false
uis.InputBegan:Connect(function(input,ispooping)
if ispooping then return end
if input.KeyCode == Enum.KeyCode.E then
cam.CameraType = "Scriptable"
Valid = true
while Valid == true do
cam.CFrame = head.CFrame
wait(Amount)
end
end
end)
uis.InputEnded:Connect(function(input,ispooping)
if ispooping then return end
if input.KeyCode == Enum.KeyCode.E then
cam.CameraType = "Fixed"
cam.CameraSubject = urPlayer
Valid = false
end
end)
local run = game:GetService("RunService")
local userInput = game:GetService("UserInputService")
local players = game:GetService("Players")
local player = players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local head = character:WaitForChild("Head")
local camera = workspace.CurrentCamera
local toggle = false
local connection
userInput.InputBegan:Connect(function(input, processed)
if processed then return end
if input.KeyCode == Enum.KeyCode.E then
toggle = not toggle
if toggle then
camera.CameraType = Enum.CameraType.Scriptable
connection = run.RenderStepped:Connect(function()
camera.CFrame = head.CFrame
end)
else
if connection then
if connection.Connected then
connection:Disconnect()
end
end
camera.CameraType = Enum.CameraType.Custom
camera.CameraSubject = humanoid
end
end
end)