Simple Motion Blur script for beginners!

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
8 Likes

Nice tutorial, wouldn’t it be better to run it on a RunService.Heartbeat though because it’s more consistant and runs every frame

hmm yes that is true but i can also do RunService.RenderStepped:Wait() instead of wait()

1 Like

task.wait()? idk which is more reliable

task.wait() is better but i use wait()

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.

9 Likes

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.

You shouldn’t use “wait()” in a while true do. What you should use is RunService.Heartbeat or RenderStepped for loops and such

(btw task.wait() is faster than wait() since task relies on the heartbeat)

1 Like

i freaking did use it like fr after the first post i changed it but people still post the same damn thing over and over again!

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.