I am trying to make this script change a value when "Q" has been pressed down. Here is the script:
function onKeyPress(inputObject, gameProcessedEvent) if inputObject.KeyCode == Enum.KeyCode.Q then local Place = true if Place then game.Players.LocalPlayer.PlaceMode.Value = false Place = false if not Place then game.Players.LocalPlayer.PlaceMode.Value = true end end end end game:GetService("UserInputService").InputBegan:connect(onKeyPress)
The reason this isn't working properly is because you are setting the value of place down to true every time the function runs
local Place = true function onKeyPress(inputObject, gameProcessedEvent) if inputObject.KeyCode == Enum.KeyCode.Q then if Place==true then Place = false game.Players.LocalPlayer.PlaceMode.Value = false elseif Place==false then place = true game.Players.LocalPlayer.PlaceMode.Value = true end end end game:GetService("UserInputService").InputBegan:connect(onKeyPress)
Also your not using elseif