ScreenShake the closer you are to a part!

I wanna make a system where the closer you are to a part the more your screen shakes but im not really sure how to, all i know is it needs cframe.angles and math.clamp

Make a shaking system and add something to multiply its intensity by the magnitude of the character’s HumanoidRootPart position and the “shaking part” position.

I made a heartbeat thats clamped the distance of the player but this is how it turns out

You’re using the cameras current position/rotation or whatever as the base so the shake keeps adding on to it and making it move out of place most likely