Effect module a simple script for simple effects!

This is a module for your effects!

Getting it set up
First get this model link:
https://web.roblox.com/library/9697404307/EffectModule

Then import it into your game.

Now you want to require it.

local EffectModule =  require(script:WaitForChild("EffectModule"))

So lets say you want a fast heartbeat effect well it has it:

local EffectModule =  require(script:WaitForChild("EffectModule"))

wait(2)

while task.wait(1) do
	EffectModule("Heartbeat")
end

How to add a custom effect
This is simple.

In the module code you should add a elseif statement after line 84.

	elseif EffectType == "Your custom effect name here" then

Then inside of that you can add a tween like this example:

	local ti = TweenInfo.new(0.5)
	local Tween = TweenService:Create(Camera, ti, {FieldOfView = 120})
		
		
	Tween:Play()

Simple!

Source code

--[[

    Effect Module:
    
    BlankScreen
    FastHeartbeat
    Sprint1
    Sprint2
    LowHealth1
    LowHealth2

]]

local Lighting = game:GetService("Lighting")
local TweenService = game:GetService("TweenService")
local Camera = workspace.CurrentCamera

local blankScreen = Instance.new("ColorCorrectionEffect")
blankScreen.Name = "BlankScreen"
blankScreen.Parent = Lighting

local redScreen = Instance.new("ColorCorrectionEffect")
redScreen.Name = "LowHealthScreen"
redScreen.Parent = Lighting


local function SetEffectType(EffectType)
	if EffectType == "BlankScreen" then
		local ti = TweenInfo.new(10)
		local Tween = TweenService:Create(blankScreen, ti, {Brightness = 1})

		Tween:Play()
		script:WaitForChild("Tinnitus"):Play()

		task.spawn(function()
			Tween.Completed:Connect(function()
				TweenService:Create(blankScreen, TweenInfo.new(1), {Brightness = 0}):Play()
				script:WaitForChild("Tinnitus"):Stop()
			end)
		end)
	elseif EffectType == "Heartbeat" then
		local ti = TweenInfo.new(0.5)
		local Tween = TweenService:Create(Camera, ti, {FieldOfView = 80})
		
		Tween:Play()
		
		script:WaitForChild("Heartbeat"):Play()
		
		task.spawn(function()
			Tween.Completed:Connect(function()
				TweenService:Create(Camera, ti, {FieldOfView = 70}):Play()
				script:WaitForChild("Heartbeat"):Stop()
			end)
		end)
	elseif EffectType == "Sprint1" then
		local ti = TweenInfo.new(0.5)
		local Tween = TweenService:Create(Camera, ti, {FieldOfView = 90})

		Tween:Play()
	elseif EffectType == "Sprint2" then
		local ti = TweenInfo.new(0.5)
		local Tween = TweenService:Create(Camera, ti, {FieldOfView = 70})

		Tween:Play()
	elseif EffectType == "LowHealth1" then
		local ti = TweenInfo.new(0.5)
		local Tween = TweenService:Create(Camera, ti, {FieldOfView = 50})
		
		script:WaitForChild("Breath"):Play()
		
		TweenService:Create(redScreen, ti, {TintColor = Color3.new(1, 0, 0)}):Play()
		

		Tween:Play()
	elseif EffectType == "LowHealth2" then
		local ti = TweenInfo.new(0.5)
		local Tween = TweenService:Create(Camera, ti, {FieldOfView = 70})
		
		script:WaitForChild("Breath"):Stop()
		
		TweenService:Create(redScreen, ti, {TintColor = Color3.new(1, 1, 1)}):Play()
		
		
		Tween:Play()
	else
		warn(EffectType.." is not a effect type.")
	end
end


return SetEffectType

A example

So yeah this is a end of the page.

5 Likes

Seems like a cool module, but isn’t the FoV change on the heartbeat a little excessive?

1 Like

No I don’t think so. because the fov is set to 80 instead of 70. You can change it.

That’s exactly what I was thinking. The module is very nice, but the FOV is a bit too high :slight_smile:

Well, I know that of course. Though, I still think you should lower it to go up to 75. 80 is very excessive.

1 Like

Nice module, although I will say using if statements for checking the effect type might not be the most efficient nor organized way, so you could do something like this:

local effects = {
   ["Test"] = function(string)
      -- do whatever
      print(string)
   end,

   ["Test2"] = function(a, b)
      -- idk
      print(a + b)
   end,
}

local function SetEffectType(EffectType, ...)
   local effect = effects[EffectType]
   effect(...)
end

That’s the way I usually do it

Anyways keep up the good work!

Thanks for a more efficient way. I will put this on the next update.

UPDATE 2

The model has been moved.
Added Shake and HealthChanged.