#My Camera System is not working(i can only look once around me)

1 messages · Page 1 of 1 (latest)

lunar burrow
#

Script (By myself):
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local cam = game.Workspace.CurrentCamera

local RunService = game:GetService("RunService")
local UIS = game:GetService("UserInputService")

local Root = char:WaitForChild("HumanoidRootPart")

local Offset = CFrame.new(0, 3, 10)

local TargetCF = Root.CFrame * Offset

local MousePressed = false

UIS.InputBegan:Connect(function(key, GP)
if GP then return end
if key.UserInputType == Enum.UserInputType.MouseButton2 then
MousePressed = true
cam.CameraType = Enum.CameraType.Custom
end
end)

UIS.InputEnded:Connect(function(key, GP)
if GP then return end
if key.UserInputType == Enum.UserInputType.MouseButton2 then
MousePressed = false
cam.CameraType = Enum.CameraType.Scriptable
end
end)

RunService.RenderStepped:Connect(function()
if MousePressed == false then
TargetCF = TargetCF:Lerp(Root.CFrame * Offset, 0.1)
cam.CFrame = TargetCF
end
end)

vital crater
#

wdym by look once around me? also u should wrap ur code in

#

and if u want it to recognise lua terms (like and, if, then) put lua on the same line like so: