Advanced Flashlight (Horror Game)


I have been seeing many people wondering about how to make a flashlight with a ring and follows the player camera like Apeirophobia, I have created a module that is open source just for that. Mind you this would be ALOT better with ray casting but I didn’t add it. I made it very very easy to use as well. The requirements needed for this is Basics of Module Scripts and Future lighting.

Post Solution: Help

Module: Flashlight Module Source

How to use:

Tutorial: Video


-- Local Script in startercharacterscripts --

local Character = script.Parent

local Humanoid = Character:WaitForChild("Humanoid")
local HRP = Character:WaitForChild("HumanoidRootPart") -- any object

local FlashlightModule = require("LOCATION OF MODULE") -- People that have no knowledge of module scripts always mess up on this part. This tutorial was made for the people who have knowledge but I'll cover this any ways. If your module is placed in the local script put "require(script:WaitForChild("FlashlightModule"))" and that's it.

local UIS = game:GetService("UserInputService")

local On = false
local db = false

local function Emission()
	if not db then
		db = true
		if not On then
			if Humanoid.Health > 0 then
				On = true

				game.ContextActionService:SetTitle("Flashlight", "Off")
			if Humanoid.Health > 0 then
				On = false

				game.ContextActionService:SetTitle("Flashlight", "On")
		db = false

	if On then

game.ContextActionService:BindAction("Flashlight", Emission, true, Enum.KeyCode.F or Enum.KeyCode.ButtonB)
game.ContextActionService:SetPosition("Flashlight",, 105,0.2, 0))
game.ContextActionService:SetTitle("Flashlight", "On")

Video Demonstration:

Test Place: Game
(There are next bots in the game!)

Please enjoy this module. :wave:


where do i put the module?
i never use em

Inside the local script, replicated storage maybe? Pretty much anywhere as long as you link a source on where it is in the local script.

I recommend local script.


Is this on client and server side?

This flashlight runs completely on CLIENT SIDED* (made a mistake). If it ran server sided everyone would see the players flashlight follow their camera. That’s why it is your decision to add your OWN server sided flashlight coming from the players torso.



First of all, I want to say that this is an epic module and thanks for open sourcing it.

Quick question, is there any way to fix the “Buggyness” of it?
In the video, and in my test world, the light is glitchy.

I was thinking about it for a while, how to make a light that does not bug.
What if there was a imageframe (Covering the whole screen), when you have the light off, its a semi-transparent solid image, then when the light is on, there is a little “Cutout” in the middle.

This combined with a light might give a better result. Very unsure though… just wanted to double check I am not missing something before I spend ages trying to get my theory to work.


I wouldn’t like images. In games like apeirophobia you can see the “jitteriness” of the ring. They cover it up by adding a walk animation to the light.

PS: Also the jitteriness of the looking can be covered up by tween or lerp speed. But yeah, glad most of you are liking this post. Keep liking so more people can come upon this post :smile:

1 Like

Did the LocalScript in StarterCharacterScripts update? I did everything right but it shows in my Console that ‘Attempted to call require with invalid argument(s).’

EDIT: I forgot i placed FindFirstChild instead of WaitForChild.

1 Like

This an amazing module btw so thank you for open sourcing it. I am curious how you would make this server sided as I have been experimenting around with this module and the only way I can think of doing it would be to send the players camera CFrame with remote events every .2 seconds or so to update the light part. Is there a better method to replicate this?


you could always just do client-server replication via RemoteEvents


Thank you for clearing this up, haven’t been on lately cause of school and stuff.

Instead of loops try using RunService. It is way more optimized and doesn’t hurt performance as much as while loops do. RunService updates with the frames you see so it would be smooth

1 Like