I'm having an error but I thought I did everything right

I’m making a camera bobbing script and I’m getting this error any idea whats going on.
image

local Client = game.Players.LocalPlayer
local Appearance = Client.Character or Client.CharacterAdded:wait()
local Humanoid = Appearance:FindFirstChild("Humanoid")
local Magnitude = Humanoid.MoveDirection.Magnitude -- errors :(

Try changing

local Humanoid = Appearance:FindFirstChild("Humanoid")

To

local Humanoid = Appearance:WaitForChild("Humanoid")

So it waits for the humanoid to exist before continuing

1 Like

It worked but I have a new error D:

image

local CamOffset = Humanoid.CameraOffset

Number? Could you show me the full code?

local CamOffset = Humanoid.CameraOffset
	local CamO07 = CamOffset * 0.7
	CamOffset = Vector3.new
	Humanoid = 0
	local Num4 = 0
	local Num5 = 0
	Magnitude.CameraOffset = CamO07 + CamOffset(Humanoid, Num4, Num5)
end

Wait I’m dumb, I think it may be that Humanoid = 0 line

Okay yea It’s because of that Humanoid = 0 line, I think you need to rename that variable

New errorrr

	local CamOffset = Humanoid.CameraOffset
	local CamO07 = CamOffset * 0.7
	CamOffset = Vector3.new
	local Humanoid2 = 0
	local Num4 = 0
	local Num5 = 0
	Magnitude.CameraOffset = CamO07 + CamOffset(Humanoid2, Num4, Num5)
end

What’s the error this time around? I think it’s probably that Magnitude result sdon’t have a CameraOffset, did you mean to d o taht on the Humanoid?

local CamOffset = Humanoid.CameraOffset
local CamO07 = CamOffset * 0.7
local Humanoid2 = 0
local Num4 = 0
local Num5 = 0
Humanoid.CameraOffset = CamO07 + Vector3.new(Humanoid2, Num4, Num5)

I’m getting no errors but the script isn’t working at all :frowning:

I think it’s probably because the CameraOffset is 0,0,0 and then you’re trying to mutliply it by 0.7, which is still the same, and then add another vector3 to it which just results in 0,0,0.

Try changing the numbers that Humanoid2, Num4, and Num5 contain