Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local runService = game:GetService("RunService")
- local character = script.Parent
- local humanoid = character:WaitForChild("Humanoid")
- function updCameraShake()
- local currentTime = tick()
- if humanoid.MoveDirection.Magnitude > 0 then
- local shakeX = math.cos(currentTime * 10) * .2
- local shakeY = math.abs(math.sin(currentTime * 10)) * .2
- local shake = Vector3.new(shakeX, shakeY, 0)
- humanoid.CameraOffset = humanoid.CameraOffset:lerp(shake, .25)
- else
- humanoid.CameraOffset = humanoid.CameraOffset * .7
- end
- end
- runService.RenderStepped:Connect(updCameraShake)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement