Advertisement
HowToRoblox

DetectKey

Apr 6th, 2021 (edited)
3,261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.72 KB | None | 0 0
  1. local uis = game:GetService("UserInputService")
  2.  
  3.  
  4. local char = script.Parent
  5.  
  6.  
  7. local equipRE = game.ReplicatedStorage:WaitForChild("NVGsToggled")
  8.  
  9.  
  10. local defaultAmbient = game.Lighting.OutdoorAmbient
  11.  
  12.  
  13.  
  14. uis.InputBegan:Connect(function(input, processed)
  15.    
  16.    
  17.     if processed then return end
  18.    
  19.    
  20.     if input.KeyCode == Enum.KeyCode.E then
  21.        
  22.        
  23.         if not char:FindFirstChild("NVGs") then
  24.            
  25.             equipRE:FireServer(true)
  26.            
  27.            
  28.             game.Lighting.OutdoorAmbient = Color3.fromRGB(255, 255, 255)
  29.             game.Lighting.ColorCorrection.Enabled = true
  30.            
  31.         else
  32.            
  33.             equipRE:FireServer(false)
  34.            
  35.            
  36.             game.Lighting.OutdoorAmbient = defaultAmbient
  37.             game.Lighting.ColorCorrection.Enabled = false
  38.         end
  39.     end
  40. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement