How do I make it so that, for example, when I press a key, the transparency of a part changes to 1, and when I press again, it changes to 0? I use Keyboardinput for this, and I want to know how to 'change' something when I press a key, and 'change' it back when I press it again.
Here you can see what I'm trying to do..
function onKeyPress(inputObject, gameProcessedEvent)
if inputObject.KeyCode == Enum.KeyCode.R then
Tool.examplepartthing.Transparency = 0.65
wait()
end
end
game:GetService("UserInputService").InputBegan:connect(onKeyPress)

1 comment
( I actually already know the part where you can 'change' something when you press it, but I really need to know how to change it back when you press it again