Humanoid.CameraOffset not working?

I’m trying to make camera shake, the loop works but humanoid cameraoffset does not do anything at all, whether I change it on my player’s humanoid in game, or within a local script, it doesn’t work.

Code: for i = 1, 25 do
local x = math.random(-120,120)/120
local y = math.random(-120,120)/120
local z = math.random(-120,120)/120
Humanoid.CameraOffset = Vector3.new(x,y,z)
print(i)
wait()
end


can someone help?

You should use the Camera’s CFrame property to create a shaking effect.

local Camera = game.Players.LocalPlayer.Camera
local Humanoid = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")

for i = 1, 25 do
    local shakeOffset = Vector3.new(math.random(-120, 120)/120, math.random(-120, 120)/120, math.random(-120, 120)/120)
    Camera.CFrame = Camera.CFrame * CFrame.new(shakeOffset)
    print(i)
    wait()
end

Thank you, it worked!!!