Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to to make a ColorCorrectionEffect go away after 10 seconds?

local UIS = game:GetService('UserInputService')
local Player = game.Players.LocalPlayer
local Character = Player.Character

local Color = game:GetService('Lighting')

UIS.InputBegan:connect(function(input)
    if input.KeyCode == Enum.KeyCode.C then

        Color = (Instance.new("ColorCorrectionEffect")) 
        Color.Name = "BlackAndWhite" 
        Color.Brightness = 0 
        Color.Contrast = 0
        Color.Enabled = true 
        Color.Saturation = -1 
        Color.TintColor = Color3.fromRGB(255,255,255) 
        Color.Parent = game.Lighting 
        local Anim = Instance.new('Animation')
        Anim.AnimationId = 'rbxassetid://YourOwnID'
        PlayAnim = Character.Humanoid:LoadAnimation(Anim)
        PlayAnim:Play()
    end
end)

UIS.InputEnded:connect(function(input)
     wait(10)--- what i tried but i didnt work
        if Color then
            Color:Destroy()
        end

        PlayAnim:Stop()
    end
end)

since im not very skilled at coding idk how to make it so it disapears after 10 seconds so i tried sum but it didnt work

1 answer

✓ Accepted answer

Use wait(10) to pause the script for 10 seconds and delete the ColorCorrection.

wait(10)
Color:Destroy()

Place this where ever you want to wait then delete

Note that you will need to change color to the thing you want to delete if you change your variables

2 comments

0

Remove() is deprecated. You should use Destroy() instead

0

fixed it

This discussion is preserved as it was. New answers, comments, and votes are closed.