I’m not sure how to use BindAction, but here’s with UserInputService:
local UIS = game:GetService("UserInputService")
local KeyBind = script.Parent.KeyBind.LocalScript.Keybind
local toggle = false
UIS.InputBegan:Connect(function(key, typing)
if not typing and key.KeyCode == Enum.KeyCode[KeyBind.Value] then
toggle = not toggle
print(toggle and "on" or "off")
print(KeyBind.Value)
end
end)
Also, I’m assuming the KeyBind Value is the name/key