I watched tutorials on camera bobble effect and a tutorial where you can see your bottom torso of your body except the head. These scripts works fine, until today I realize both scripts don’t work at the same time because both has camera offset both included in them. So I tried to combine the 2 scripts into one, but got confused which made me stop at line 36.
So I would like advice on what I can do to fix this or go about this. I want both of these mechanics in my game if that’s even possible at this point.
Camera Bobble Script
local runService = game:GetService(“RunService”)
local character = script.Parent
local humanoid = character:WaitForChild(“Humanoid”)function updateBobble()
local currentTime = tick()
if humanoid.MoveDirection.Magnitude > 0 then
local bobbleX = math.cos(currentTime * 10) * 1
local bobbleY = math.abs(math.sin(currentTime * 10)) * 1local bobble = Vector3.new(bobbleX, bobbleY, 0) humanoid.CameraOffset = humanoid.CameraOffset:lerp(bobble, .25)
else
humanoid.CameraOffset = humanoid.CameraOffset * .75
end
endrunService.RenderStepped:Connect(updateBobble)
POV Camera Script
local player = game.Players.LocalPlayer
local char = player.Character
local RunService = game:GetService(“RunService”)char.Humanoid.CameraOffset = Vector3.new(0, 0, -1)
for i, v in pairs(char:GetChildren()) do
if v:IsA(“BasePart”) and v.Name ~= “Head” thenv:GetPropertyChangedSignal("LocalTransparencyModifier"):Connect(function() v.LocalTransparencyModifier = v.Transparency end) v.LocalTransparencyModifier = v.Transparency
end
endRunService.RenderStepped:Connect(function(step)
local ray = Ray.new(char.Head.Position, ((char.Head.CFrame + char.Head.CFrame.LookVector * 2) - char.Head.Position).Position.Unit)
local ignoreList = char:GetChildren()local hit, pos = game.Workspace:FindPartOnRayWithIgnoreList(ray, ignoreList)
if hit then
char.Humanoid.CameraOffset = Vector3.new(0, 0, -(char.Head.Position - pos).magnitude)
else
char.Humanoid.CameraOffset = Vector3.new(0, 0, -1)
end
end)