game.ReplicatedStorage.ScreenShake.OnServerEvent:connect(function(player, duration)
local humanoid = player.Character.Humanoid
local timer = tick()
if humanoid.Health <= 1 then
return
end
while timer <= duration do
print("d")
humanoid.CameraOffset = Vector3.new(math.random(-2, 2), math.random(-2, 2), math.random(-2, 2))
wait(0.2)
end
humanoid.CameraOffset = Vector3.new(0, 0, 0)
end)
Problem is when I print (timer, duration) it will print the timer as like a number in the 1,000,000s and the duration as 2. How do I make it so that timer is the time that has passed since I started the loop so that when it passes the duration the camera will stop shaking?
P.S. using this so I can just fire it to the server whenever I need it shake.

2 comments
ScreenShake is an effect so should be done on the client side
^ Yup, he's right! Only the locals can feel it.