Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Is it possible to blur a players screen on death?

Asked by 7 years ago

I am trying to blur certain players screens on there death or something else.

Whenever I use a blur since lighting is server side it does the same thing to all players. So when 1 player dies it replicated the blur effect to everyone.

Does anyone have any tutorials or know any that may be able to help me out.

Sorry I dont have the code in here, I dont really have any code at the moment. I have toyed around with blurring but it always blurs everyone.

Thank you for your time :)

0
well if you figured out how to blur all the players, just put the same script into a LOCAL script so It only does it for each individual player when they die. Au_Naturel -26 — 4y

3 answers

Log in to vote
1
Answered by 7 years ago

I'm a bit late to the party, but here's my solution. It works similar to Godlydeathdragon's script, but it uses a Tween to gradually fade the blur. It also includes 2 options to set the delay before the blur starts fading in after death, and the duration of the fade-in. Just like Godlydeathdragon's script, this should be in a LocalScript in StarterPlayerScripts

local TweenService = game:GetService("TweenService")
local blurDelay = 0 --seconds
local blurDuration = 6 --seconds
local blurEffect = Instance.new("BlurEffect")
blurEffect.Size = 0
blurEffect.Enabled = false
blurEffect.Parent = game.Workspace.CurrentCamera
local tween

local function createTween()
    local tweenInfo = TweenInfo.new(blurDuration, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, blurDelay)
    return TweenService:Create(blurEffect, tweenInfo, {Size = 56})
end

game.Players.LocalPlayer.CharacterAdded:Connect(function(character)
    local humanoid = character:WaitForChild("Humanoid")
    if tween and tween.PlaybackState == Enum.PlaybackState.Playing then
        tween:Cancel()
    end
    blurEffect.Size = 0
    blurEffect.Enabled = false
    humanoid.Died:Connect(function()
        blurEffect.Enabled = true
        tween = createTween()
        tween:Play()
    end)
end)
Ad
Log in to vote
2
Answered by 7 years ago
Edited 7 years ago

By setting the blur effect's parent to the player's Camera, I believe this will make only the player who died see the blur effect

PUT THIS SCRIPT IN STARTERPLAYER UNDER STARTERCHARACTERSCRIPTS

local char = script.Parent

local humanoid = char:FindFirstChild("Humanoid")

local camera = workspace.CurrentCamera

humanoid.HealthChanged:connect(function(health)
    if health == 0 then
        game.Lighting.Blur.Enabled = true
        game.Lighting.Blur.Parent = camera
    end
end)
0
This doesnt work... Sorryyy, but why is this problem so hard. Ive seen very basic games have this ya know XD. Any other ideas? GottaHaveAFunTime 218 — 7y
0
Oh no it seems it does work, I changed it and now it does work... Hmm a little odd but as long as it works! :) thanks my dude. GottaHaveAFunTime 218 — 7y
0
just wondering, does humanoid:Died() function has the same effect? PumpedRedfalconPE 17 — 7y
0
Yes, but instead you use humanoid.Died:connect(function() or something similar to that Godlydeathdragon 227 — 7y
Log in to vote
0
Answered by 4 years ago
local player = game.Players.LocalPlayer
local Character = player.Character
local Humanoid = Character:WaitForChild("Humanoid")
local Blurdeadfind = game.Lighting:FindFirstChild("Blurdead")
local ColorDead = game.Lighting:FindFirstChild("ColorDead")
if Blurdeadfind and ColorDead then
    game:GetService("TweenService"):Create(Blurdeadfind,TweenInfo.new(1,Enum.EasingStyle.Linear),{Size = 0}):Play()
    game:GetService("TweenService"):Create(ColorDead,TweenInfo.new(1,Enum.EasingStyle.Linear),{Brightness = 0}):Play()
    wait(2)
    Blurdeadfind:Destroy()
    ColorDead:Destroy()
    else
end
Humanoid.Died:Connect(function()
    local cam = game.Workspace.CurrentCamera
    cam:ClearAllChildren()
    local BlurDead = Instance.new("BlurEffect",game.Lighting)
    local ColorCorr = Instance.new("ColorCorrectionEffect",game.Lighting)
    ColorCorr.Name = "ColorDead"
    BlurDead.Size = 0
    game:GetService("TweenService"):Create(BlurDead,TweenInfo.new(1,Enum.EasingStyle.Linear),{Size = 56}):Play()
    game:GetService("TweenService"):Create(ColorCorr,TweenInfo.new(2,Enum.EasingStyle.Linear),{Brightness = -1}):Play()
    BlurDead.Name = "Blurdead"
end)

This is for those who are searching for this and are sent here ;P

Answer this question