game.ReplicatedStorage.Events.CameraShake.OnServerEvent:Connect(function(plr)
local char = plr.Character or plr.CharacterAdded:Wait()
local camOffset = char:FindFirstChild(“Humanoid”).CameraOffset
for i = 1,30 do
local rando = math.random(-5, 5)
camOffset = Vector3.new(rando, rando, rando)
print(“done”)
print(camOffset)
wait()
end
end)
the reason it is not working is because on line 3, where you make the variable “camOffset”, you put it to Humanoid.CameraOffset.
the variable is reading the property, not referencing it.
to fix this, remove the camOffset variable all together and apply the humanoid’s camera offset manually.
here is a fixed version of your script, let me know if it errors.
game.ReplicatedStorage.Events.CameraShake.OnServerEvent:Connect(function(plr)
local char = plr.Character or plr.CharacterAdded:Wait()
local humanoid = char:FindFirstChild(“Humanoid”)
for i = 1,30 do
humanoid.CameraOffset = Vector3.new(math.random(-5, 5), math.random(-5, 5), math.random(-5, 5))
print(“done”)
print(camOffset)
wait()
end
end)
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local humanoid = char:FindFirstChild("Humanoid")
for i = 1,100 do
local randoX = math.random(-80, 80) / 400 -- random offset (X)
local randoY = math.random(-80, 80) / 400 -- random offset (Y)
local randoZ = math.random(-80, 80) / 400 -- random offset (Z)
humanoid.CameraOffset = Vector3.new(randoX, randoY, randoZ)
task.wait(.04)
end
-- normal offset
humanoid.CameraOffset = Vector3.new(0, 0, 0)