I can't figure it out, can someone help me, please?
local uis = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local UiElements = game.ReplicatedStorage.UIElements
local char=player.Character or player.CharacterAdded:wait()
local focusing = false
Target = "placeholder"
uis.InputBegan:Connect(function(input)
if (input.KeyCode == Enum.KeyCode.L) then
focusing = not focusing
if (not focusing) then
game.Workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
else
local LockOnui = UiElements.Lockon:Clone()
LockOnui.Parent=Target
game.Workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
end
end
end)
while game:GetService("RunService").RenderStepped:Wait() do
if (focusing) then
game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = CFrame.new(game.Players.LocalPlayer.Character.HumanoidRootPart.Position,Vector3.new(Target.Position.X,game.Players.LocalPlayer.Character.HumanoidRootPart.Position.Y,Target.Position.Z))
game.Workspace.CurrentCamera.CFrame = game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame*CFrame.new(Vector3.new(3,2.5,5))
elseif not focusing and Target:FindFirstChild("Lockon") then
Target.Lockon:Destroy()
end
end
