FLASHLIGHT MODULE (UPDATED)
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
JUST STATING THAT THIS MODULE IS NOT MEANT FOR THIRD PERSON USES
How to use:
Tutorial: Video
Script:
-- 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
FlashlightModule.CreateFlashlight(HRP)
game.ContextActionService:SetTitle("Flashlight", "Off")
end
else
if Humanoid.Health > 0 then
On = false
FlashlightModule.RemoveFlashlight(HRP)
game.ContextActionService:SetTitle("Flashlight", "On")
end
end
wait(1)
db = false
end
end
Humanoid.Died:Connect(function()
if On then
FlashlightModule.RemoveFlashlight(HRP)
end
end)
game.ContextActionService:BindAction("Flashlight", Emission, true, Enum.KeyCode.F or Enum.KeyCode.ButtonB)
game.ContextActionService:SetPosition("Flashlight", UDim2.new(0.2, 105,0.2, 0))
game.ContextActionService:SetTitle("Flashlight", "On")
** Working Flashlight Script **
Video Demonstration:
Test Place: Game
(There are next bots in the game!)
Most of all, please enjoy this module and like it!
UPDATE: I have been off from coding for the past 3 years due to having no device to code with, at the moment just playing Roblox on a console. I hope that this changes this year and hope to make the best update to this module asap.