Flashlight Light Broken

Hi all I am making a horror hame and I want the light of my flashlight to turn off when you run out of battery. I have gotten the battery part to work but what I’m struggling with now is making it so the light turns out. The flashlight is a tool the player is forced to hold. Thank you devs!

Error: Flashlight is not a valid member of Player “Players.anygamesalldaylong”

Script: while true do
wait(0.1)
game.Players.LocalPlayer.Flashlight.Part.Light.Brightness = 0
script.Parent.Enabled = false
end

The flashlight may not exist or load in time, so you would want to do:

game.Players.LocalPlayer:WaitForChild("Flashlight").Part.Light.Brightness = 0

Oh, oops, skimmed over the part where you said Tool. Use this instead:
Edit: Use this script instead. Tools once holded, are put into the character.

game.Players.LocalPlayer.Character:WaitForChild("Flashlight").Part.Light.Brightness = 0```

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.