I found this script a while back and I wanted to fix and reuse it but I keep get errors and I have no clue on how to fix it I tried to find a fix here :: Humanoid.CameraOffset but no solutions! Any ideas on how to fix it?
error::
full script ::
updateBobbleEffect = function(…)
local datick = tick()
local hum = script.Parent:WaitForChild(“Humanoid”)
local magnitude = hum.MoveDirection.Magnitude
local xnum = 0
if xnum < magnitude then
hum = datick * 5
xnum = math.cos
magnitude = xnum(hum) * 0.35
hum.CameraOffset = hum.CameraOffset:lerp(Vector3.new(magnitude, math.abs(math.sin(datick * 5)) * 0.35, 0), 0.25)
end
local offsetA = hum.CameraOffset
local offsetB = offsetA * 0.75
hum.CameraOffset = offsetB
end
This line is causing the error, you first set hum to the Humanoid of the character, but then this line overwrites it, causing your error as a number does not contain a property called CameraOffset, you need to rename something so this wont cause any overwriting.
Perhaps try
updateBobbleEffect = function(…)
local datick = tick()
local hum = script.Parent:WaitForChild(“Humanoid”)
local magnitude = hum.MoveDirection.Magnitude
local xnum = 0
if xnum < magnitude then
local num = datick * 5
xnum = math.cos
magnitude = xnum(num) * 0.35
hum.CameraOffset = hum.CameraOffset:lerp(Vector3.new(magnitude, math.abs(math.sin(datick * 5)) * 0.35, 0), 0.25)
end
local offsetA = hum.CameraOffset
local offsetB = offsetA * 0.75
hum.CameraOffset = offsetB
end