--[[ Toggle player visibility by pressing the F1 key Instead of using an "if" statement we increment _playerInvis by 1 each time and check if it's divisible by 2, switching between true and false each time. --]] local _playerInvis = 0 function OnBindingPressed(player, binding) if(binding == "ability_extra_50")then print( "Pressed: ",binding ) _playerInvis = _playerInvis + 1 player:SetVisibility(_playerInvis%2 == 0) end end function OnPlayerJoined(player) -- hook up binding in player joined event here player.bindingPressedEvent:Connect(OnBindingPressed) --player.bindingReleasedEvent:Connect(OnBindingReleased) end -- on player joined/left functions need to be defined before calling event:Connect() Game.playerJoinedEvent:Connect(OnPlayerJoined)