I would like this code to follow my head (Similar to TSB cam) While keeping the same properties it has now. I also need help making it more smooth and other things, Thank you in advance.
Here’s the code:
--Services
local userInputService = game:GetService("UserInputService")
local runService = game:GetService("RunService")
local TweenService = game:GetService("TweenService")
--Player & Character
local plr = game:GetService("Players").LocalPlayer
local Character = plr.Character or plr.CharacterAdded:Wait()
local hum = Character:WaitForChild("Humanoid")
local hrp = Character:WaitForChild("HumanoidRootPart")
--Other
local Camera = game:GetService("Workspace").CurrentCamera
function Update()
TweenService:Create(hum, TweenInfo.new(0.75, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {CameraOffset = (hum.MoveDirection) * 2}):Play()
if hum.MoveDirection.Magnitude <= 0 then
TweenService:Create(hum, TweenInfo.new(0.75, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {CameraOffset = (Vector3.new(0,0,0))}):Play()
end
end
runService.RenderStepped:Connect(Update)
Hello, TSB changes the PlayerModule to achieve its camera effect (I believe). It’s not recommended to recreate it with a script since you only have to change ~2 lines, I forgot what lines they are though.
I’ll try to edit this when I find out, hang on a sec.
Change lines 260 and 413 of the BaseCamera module to this local bodyPartToFollow = humanoid.Parent:FindFirstChild("Head")
and it should give you the TSB camera effect.
Yes, I can’t exactly explain it in detail because I’m not experienced enough, so I’m just gonna say it’s kinda worse if you do that, and it messes up shiftlock.
You can try by running a game and setting the camerasubject to the character’s head.