-- PUT THIS IN A LOCAL SCRIPT
local UIS = game:GetService("UserInputService")
local switch = false
UIS.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.Keyboard then
if input.KeyCode == Enum.KeyCode.F then -- replace "F" with key of your choice
if switch == true then
-- put what ever you want to happen when OFF
print("Its off!")
switch = false -- must keep this for it to work
else
-- put what ever you want to happen when ON
print("Its on!")
switch = true -- this also has to be here for it to work
end
end
end
end)