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 » Scripting Helpers
Home Search
 

Re: Whats wrong with this code?

Previous Thread :: Next Thread 
MasterDesigner is not online. MasterDesigner
Joined: 07 Mar 2010
Total Posts: 3915
27 Dec 2011 08:30 PM
function onKEY(key)
if key == ("e") then
script.parent.Silencer.Transparency = 0
end

function onSelected(mouse)
mouse.KeyDown:connect(onKEY)
end

script.Parent.Selected:connect(onSelected)
-----

Its a localscript inside a tool to make a brick within the tool become visible. However, when I test it, the script doesnt not work. What's wrong with it? ._.
Report Abuse
ggfunny1234 is not online. ggfunny1234
Joined: 09 Jul 2010
Total Posts: 3432
27 Dec 2011 08:31 PM
Output?
Report Abuse
MasterDesigner is not online. MasterDesigner
Joined: 07 Mar 2010
Total Posts: 3915
27 Dec 2011 08:33 PM
I'm new to scripting, so I really dont understand the lingo that applies to it. I'm here to learn. ^_^
Report Abuse
Trapper4O77 is not online. Trapper4O77
Joined: 03 Aug 2011
Total Posts: 5648
27 Dec 2011 08:36 PM
view>Output
press play
Copy-paste output here

~Trappee?Trapper~
Report Abuse
pauljkl is not online. pauljkl
Joined: 23 Oct 2008
Total Posts: 9364
27 Dec 2011 08:37 PM
Doesnt parent need a capital?
Report Abuse
bikerking200 is not online. bikerking200
Joined: 11 Mar 2010
Total Posts: 5047
27 Dec 2011 08:40 PM
    function onKEY(key)
    if key == ("e") then
    script.Parent.Silencer.Transparency = 0
    end
    function onSelected(mouse)
    mouse.KeyDown:connect(onKEY)
    end
    script.Parent.Selected:connect(onSelected)

Good eye Paul.

http://www.roblox.com/Part-Generator-Plugin-V3-item?id=68342522
Report Abuse
MasterDesigner is not online. MasterDesigner
Joined: 07 Mar 2010
Total Posts: 3915
27 Dec 2011 08:42 PM
Will the output show a script's data if its in the tool? Or does it need to be in a special space?
Report Abuse
MasterDesigner is not online. MasterDesigner
Joined: 07 Mar 2010
Total Posts: 3915
27 Dec 2011 08:44 PM
(The capitalization did not fix the issue.)
Report Abuse
MasterDesigner is not online. MasterDesigner
Joined: 07 Mar 2010
Total Posts: 3915
27 Dec 2011 08:47 PM
I got this from the output:

Players.Player.Backpack.SMG.Silencer Toggle:10: 'end' expected (to close 'function' at line 1) near '(eof)'
21:45:11 - Players.Player.Backpack.SMG.Script:13: 'end' expected (to close 'if' at line 9) near '(eof)'
21:45:11 - Touched is not a valid member of Backpack
Report Abuse
bikerking200 is not online. bikerking200
Joined: 11 Mar 2010
Total Posts: 5047
27 Dec 2011 08:47 PM
function onKEY(key)
if key == ("e") then
script.Parent.Silencer.Transparency = 0
end end
function onSelected(mouse)
mouse.KeyDown:connect(onKEY)
end
script.Parent.Selected:connect(onSelected)

http://www.roblox.com/Part-Generator-Plugin-V3-item?id=68342522
Report Abuse
pauljkl is not online. pauljkl
Joined: 23 Oct 2008
Total Posts: 9364
27 Dec 2011 08:48 PM
Here, your end was missing

function onKEY(key)
if key == ("e") then
script.Parent.Silencer.Transparency = 0
end end
function onSelected(mouse)
mouse.KeyDown:connect(onKEY)
end
script.Parent.Selected:connect(onSelected)
Report Abuse
ninjasassin52 is not online. ninjasassin52
Joined: 09 Feb 2010
Total Posts: 93
27 Dec 2011 08:49 PM
Im somehwhat new but from what i know shouldnt it be

key: lower
key == (whateverkeyhere)
Report Abuse
bikerking200 is not online. bikerking200
Joined: 11 Mar 2010
Total Posts: 5047
27 Dec 2011 08:49 PM
Kinda close Ninja.

http://www.roblox.com/Part-Generator-Plugin-V3-item?id=68342522
Report Abuse
MasterDesigner is not online. MasterDesigner
Joined: 07 Mar 2010
Total Posts: 3915
27 Dec 2011 08:53 PM
Its still not working. Is it supposed to be a localscript or a script? More importantly, will this run in test mode on the editor, because thats what I'm working with to test.
Report Abuse
MasterDesigner is not online. MasterDesigner
Joined: 07 Mar 2010
Total Posts: 3915
27 Dec 2011 08:57 PM
And if it means anything, its in a tool, not a Hopperbin.
Report Abuse
bikerking200 is not online. bikerking200
Joined: 11 Mar 2010
Total Posts: 5047
27 Dec 2011 09:07 PM
**function onKEY(key)
if key == ("e") then
script.Parent.Silencer.Transparency = 0
end end
function onSelected(mouse)
mouse.KeyDown:connect(onKEY)
end
script.Parent.Equipped:connect(onSelected)**

http://www.roblox.com/Part-Generator-Plugin-V3-item?id=68342522
Report Abuse
MasterDesigner is not online. MasterDesigner
Joined: 07 Mar 2010
Total Posts: 3915
27 Dec 2011 09:08 PM
That worked! Thanks. :D
Report Abuse
MasterDesigner is not online. MasterDesigner
Joined: 07 Mar 2010
Total Posts: 3915
27 Dec 2011 09:15 PM
As a final question, what would need to be added to get the key to work as a toggle? As in, only needing ONE key as an on/off feature.
Report Abuse
MasterDesigner is not online. MasterDesigner
Joined: 07 Mar 2010
Total Posts: 3915
27 Dec 2011 09:34 PM
Doesn't that need a isOn = true/off line of something?
Report Abuse
MasterDesigner is not online. MasterDesigner
Joined: 07 Mar 2010
Total Posts: 3915
27 Dec 2011 09:39 PM
*or
Report Abuse
MasterDesigner is not online. MasterDesigner
Joined: 07 Mar 2010
Total Posts: 3915
28 Dec 2011 10:03 AM
Bump because this is actually going somewhere. ^_^
Report Abuse
Darkmist101 is not online. Darkmist101
Joined: 30 Jul 2010
Total Posts: 6208
28 Dec 2011 10:17 AM
You would add values....

local Transparent = true

script.Parent.Equipped:connect(function(Mouse)

Mouse.KeyDown:connect(function(Key)

if key == ("e") then

if Transparent
script.Parent.Silencer.Transparency = 0
Transparent = false

else
script.Parent.Silencer.Transparency = 1
Transparent = true
end
end
end)
end)
Report Abuse
Darkmist101 is not online. Darkmist101
Joined: 30 Jul 2010
Total Posts: 6208
28 Dec 2011 10:18 AM
Sorry :l

local Transparent = true

script.Parent.Equipped:connect(function(Mouse)

Mouse.KeyDown:connect(function(Key)

if key == ("e") then

if Transparent then
script.Parent.Silencer.Transparency = 0
Transparent = false

else
script.Parent.Silencer.Transparency = 1
Transparent = true
end
end
end)
end)
Report Abuse
ZDude2461 is not online. ZDude2461
Joined: 26 Apr 2009
Total Posts: 347
28 Dec 2011 10:18 AM
function onKEY(key)
key = key:lower()
if key == ("e") then
script.Parent.Silencer.Transparency = 0
end end

function onSelected(mouse)
mouse.KeyDown:connect(function(key) onKEY end))
end

script.Parent.Selected:connect(onSelected)
Report Abuse
legend8887 is not online. legend8887
Joined: 06 Nov 2010
Total Posts: 13765
28 Dec 2011 10:25 AM
I know what's wrong.

You forgot to put:

-- Made by legend8887 :) There, that will fix it. :)

function onKEY(key)
if key == ("e") then
script.parent.Silencer.Transparency = 0
end

function onSelected(mouse)
mouse.KeyDown:connect(onKEY)
end

script.Parent.Selected:connect(onSelected)
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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