Hello! This is a simple motion blur scripts for all the cool KARLSON like games out there. Oh you dont know what KARLSON is? Its just a game the youtuber dani is working On yOu sHoUld dEfInAtElY cHeCk iT oUt. Anyways here you go :)
local Cam = workspace.CurrentCamera
local Blur = game.Lighting.Blur -- Path to blur in Lighting
local DefaultSize = 2 -- This is your default blur size or the minimum size
local MaxSize = 10 -- This is the max size
local Intensity = 10 -- This is the intensity
local PrevCF = Cam.CFrame.Position
while true do
local Size = ((Cam.CFrame.Position-PrevCF).Magnitude)*Intensity
Blur.Size = math.clamp(Size,DefaultSize,MaxSize)
PrevCF = Cam.CFrame.Position
game:GetService("RunService").RenderStepped:Wait()
end
You would want to use RenderStepped for this as it is dependent on the camera movement! Meaning take it out of the while loop, remove the wait, and out the rest of your code in RunService.RenderStepped. You could also use BindToRenderStep
It’s important to realize that this is not motion blur, but regular blur triggered by motion. Motion blur is contextual and directional. Your car shouldn’t blur if you’re in a car because it is moving at the same speed. When you rotate your camera quickly, you should get a directional blur that affects farther objects more than closer objects. This can’t be done with Roblox. A lot of people don’t like motion blur already, so if anybody has any ideas about using this system for motion blur, make sure you allow players to disable it. Or start it disabled and let them turn it on if they want to.
What? Come on now, unless you are doing it because you want it to be like heartbeat, in which you should use heartbeat!!! There is no reason to be using wait()
task.wait() is RunService.Heartbeat, and Heartbeat and Stepped used to be an alternative to wait(). task.wait(), Heartbeat and Stepped are the best ways to pause a script. wait() is the worse out of the 3 because it can wait longer then you want it to, causing more delay in your game.
Theres another way to replicate motion blur without using depth of field or blur…
You can use viewports for example 40 of viewports, it will replicate the motion blur but it will be a bit laggy depending on your graphics card, hope this helped.