I have a flashlight script in StarterPlayerScripts as a Local Script
-- Flashlight Script
-- SERVICES
local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local player = Players.LocalPlayer
local camera = workspace.CurrentCamera
-- SETTINGS
local TOGGLE_KEY = Enum.KeyCode.F
local BRIGHTNESS = 3
local RANGE = 60
local ANGLE = 55
local COLOR = Color3.fromRGB(255, 245, 220)
-- STATE
local flashlightOn = false
-- CREATE SPOTLIGHT
local flashlight = Instance.new("SpotLight")
flashlight.Name = "Flashlight"
flashlight.Enabled = false
flashlight.Brightness = BRIGHTNESS
flashlight.Range = RANGE
flashlight.Angle = ANGLE
flashlight.Color = COLOR
flashlight.Shadows = true
flashlight.Parent = camera
-- OPTIONAL CLICK SOUND
local click = Instance.new("Sound")
click.SoundId = "rbxassetid://9070807695"
click.Volume = 0.5
click.Parent = camera
-- INPUT
UserInputService.InputBegan:Connect(function(input, gp)
if gp then return end
if input.KeyCode == TOGGLE_KEY then
flashlightOn = not flashlightOn
flashlight.Enabled = flashlightOn
click:Play()
end
end)
-- FOLLOW CAMERA
RunService.RenderStepped:Connect(function()
if flashlight.Enabled then
flashlight.CFrame = camera.CFrame
end
end)
** You are now Level 1! **