generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

What is wrong with this Key GUI local script?

Previous Thread :: Next Thread 
pawnz is not online. 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 is not online. 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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image