Player near Explosion

Hello, So I saw this video on a discord lately and I am really wondering how to make something Like this?


If someone could explain to me how to do something like this it would be great.
Have a great day

Look into TweenService, and the Blur Effect

In a LocalScript, you could do the following

local TweenService = game:GetService("TweenService")
local CurrentCamera = workspace.CurrentCamera
local BlurEffect = Instance.new("BlurEffect")
BlurEffect.Size = 0.75
BlurEffect.Parent = CurrentCamera

TweenService:Create(BlurEffect, TweenInfo.new(3) {Size = 0}):Play()

oh hey, thats my post believe it or not!

anyways I did it by checking when a Explosion is added to the workspace and checking if the range of the player to the Explosion is the explosionRadius * 2. Then if hes close enough I enable a BlurEffect thats in lighting and slowly tween the size to 0. I also make the players Humanoid:MoveTo() away from the blast.

if you have any questions feel free to ask

4 Likes

Oh yeah, I completely forgot about the range :sob:

Interesting, But how would this look inside a code? or how do you know if a explosion is added to the workspace

roblox has a handy function,

workspace.ChildAdded:Connect(function()

end)

https://developer.roblox.com/en-us/api-reference/class/BlurEffect

https://developer.roblox.com/en-us/api-reference/function/Humanoid/MoveTo

-- localscript inside StarterCharacterScripts
local character = script.Parent
local blurEffect = Lighting.BlurEffect

-- create a tween that will fade the blurEffect to 0
local tweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(3)
local tween = TweenService:Create(blurEffect, tweenInfo, {Size = 0})

-- when a bomb part is added to the Bombs folder call this function
workspace.Bombs.ChildAdded:Connect(function(child)
    -- work out a direction vector3 from the players position to the bomb
    local direction = child.Position - character.PrimaryPart.Position
    -- if the distance is greater then 20 studs just exit the function early and don't do anything 
    if direction.Magnitude > 20 then return end
    -- set blur to a size of 1
    blurEffect.Size = 1
    -- start tweening the blur to 0
    tween:Play()
    -- make the character walk 5 studs in the opposite direction to the bomb
    character.Humanoid:MoveTo(character.PrimaryPart.Position - direction.Unit * 5)
end)
2 Likes