pawnz
|
  |
| Joined: 22 Feb 2010 |
| Total Posts: 286 |
|
|
| 27 Apr 2015 11:56 PM |
local Player = game.Players.LocalPlayer local mouse = Player:GetMouse() local keys = {} mouse.KeyDown:connect(function(key) keys[key] = true end) mouse.KeyUp :connect(function(key) keys[key] = nil end) wait(0.1)
local switch = script.Parent.Parent.Vehicle.Value local Light = switch.Parent.CpartL wait(0.1)
local trig = switch.trigger local GUI = script.Parent.Shoot
local debounce = false
while wait(0.2) do if keys["E"] then if 1+2 == 3 then --"change to if the light is not on? if range = 0?" Light.Watt:play() Light.PointLight1.Range = 10 Light.SpotLight1.Range = 60 wait(0) elseif debounce == false then --and Light.PointLight1.Range >= 0 then debounce = true GUI.Text = "Activated" Light.Watt:play() Light.Zap:play() Light.PointLight1.Range = 0 Light.SpotLight1.Range = 0 wait(1) GUI.Text = "[E] Light" debounce = false end end end |
|
|
| Report Abuse |
|
|
amanda
|
  |
| Joined: 21 Nov 2006 |
| Total Posts: 5925 |
|
|
| 27 Apr 2015 11:58 PM |
Hey there, KeyUp and KeyDown are depreciated, meaning they are outdated and shouldn't be used in scripts from now on, and are only kept for compatibility for older scripts.
They have been replaced by something called UserInputService. :) |
|
|
| Report Abuse |
|
|
pawnz
|
  |
| Joined: 22 Feb 2010 |
| Total Posts: 286 |
|
|
| 28 Apr 2015 12:04 AM |
So how would I go about making this script
"Turn the light on if it is off"
when E is pressed
and "Turn the light off if it is on"
when E is pressed? |
|
|
| Report Abuse |
|
|