------------------------






local maincf = CFrame.new(0, 0, 0)  

	
	
	equip = true
	arms = VMS:WaitForChild("v_FlashlightV2"):Clone()

	arms.HumanoidRootPart.SpotLight.Brightness = brightness
	arms.HumanoidRootPart.SpotLight.Range = range
	arms.HumanoidRootPart.SpotLight.Shadows = shadowson

	arms.Parent = cam
	arms.Name = "Arms"
	

	
	run.RenderStepped:Connect(function()
		if equip == true and arms then
			arms:SetPrimaryPartCFrame(
				cam.CFrame
				* maincf

				

			)
			


		end
	end)
	


UIS.InputEnded:Connect(function(input)
	if input.KeyCode == Enum.KeyCode[FlashlightKey] and equip == true then
		if ison == true then
			ison = false
			arms.HumanoidRootPart.SpotLight.Enabled = false
			FlashlightGui.FlashlightOn.Visible = false
			FlashlightGui.FlashlightOff.Visible = true
			arms.HumanoidRootPart.Flashlightss:Play()
			

		else
			ison = true
			arms.HumanoidRootPart.SpotLight.Enabled = true
			FlashlightGui.FlashlightOff.Visible = false
			FlashlightGui.FlashlightOn.Visible = true
			arms.HumanoidRootPart.Flashlightss:Play()
			

		end
	end
end)


local de = true
function onButtonPress()
	if de == true and equip == true then
		de = false
		if ison == true then
			ison = false
			arms.HumanoidRootPart.SpotLight.Enabled = false
			FlashlightGui.FlashlightOn.Visible = false
			FlashlightGui.FlashlightOff.Visible = true
			arms.HumanoidRootPart.Flashlightss:Play()


		else
			ison = true
			arms.HumanoidRootPart.SpotLight.Enabled = true
			FlashlightGui.FlashlightOff.Visible = false
			FlashlightGui.FlashlightOn.Visible = true
			arms.HumanoidRootPart.Flashlightss:Play()

		end
		
		wait(.75)
		de = true
	end
end


Con:SetImage("FlashLight", "rbxassetid://2883826635")	

Con:BindAction("FlashLight",onButtonPress,true,"F")



	
game.Players.LocalPlayer.Character:WaitForChild("Humanoid").Died:Connect(function()
	equip = false
	ison = false
	arms:Destroy()
end)
