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: If key, shouldn't this work?

Previous Thread :: Next Thread 
ZeetZeet is not online. ZeetZeet
Joined: 01 May 2012
Total Posts: 179
13 Jun 2012 08:24 PM
function growHum(key)

if key:lower() == "x" then
game.Players.LocalPlayer.Character.Head:Remove()
end
end
Report Abuse
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
13 Jun 2012 08:25 PM
Only if you actually call the function. And this is a localscript.

-[::ƧѡÎḾḠΰῩ::]-[::Maker of stuff and Helper of Scripting::]-
Report Abuse
ZeetZeet is not online. ZeetZeet
Joined: 01 May 2012
Total Posts: 179
13 Jun 2012 08:26 PM
I have it written in a localscript, but could you be a little more specific?
Report Abuse
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
13 Jun 2012 08:27 PM
You never tell the function to run. It's just sitting there like soggy oatmeal. Nothing will happen.

Read this:
http://wiki.roblox.com/index.php/KeyDown_(Event)

-[::ƧѡÎḾḠΰῩ::]-[::Maker of stuff and Helper of Scripting::]-
Report Abuse
ZeetZeet is not online. ZeetZeet
Joined: 01 May 2012
Total Posts: 179
13 Jun 2012 08:32 PM
local function onKeyDown(key)
function growHum(key)

if key:lower() == "x" then
game.Players.LocalPlayer.Character.Head:Remove()
end
end
end


Thats what I got, I dont know what else to do, I'm going off of Telamon's Foe Hammer, and there is nothing I see to help me out.
Report Abuse
ZeetZeet is not online. ZeetZeet
Joined: 01 May 2012
Total Posts: 179
13 Jun 2012 08:35 PM
Forgot the connecting line


local function onKeyDown(x)
function growHum(key)

if key:lower() == "x" then
game.Players.LocalPlayer.Character.Head:Remove()
end
end
end

mouse.KeyDown:connect(onKeyDown)
Report Abuse
littleAU999 is not online. littleAU999
Joined: 15 Jan 2011
Total Posts: 1375
13 Jun 2012 08:41 PM
local hop = Instance.new("HopperBin", game.Players.LocalPlayer.Backpack)
hop.Name = "Headrem"

hop.Selected:connect(function(mouse)
mouse.KeyDown:connect(function(key)
if key:lower() == "x" then
game.Players.LocalPlayer.Character.Head:Destroy()
end
end)
end)
Report Abuse
ZeetZeet is not online. ZeetZeet
Joined: 01 May 2012
Total Posts: 179
13 Jun 2012 08:43 PM
I need this all integrated into one "Tool".
Report Abuse
ZeetZeet is not online. ZeetZeet
Joined: 01 May 2012
Total Posts: 179
13 Jun 2012 09:39 PM
Anyone :/?
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
13 Jun 2012 10:20 PM
function growHum(key)

if key:lower() == "x" then
game.Players.LocalPlayer.Character.Head:Remove()
end
end

local Tool = script.Parent

Tool.Equipped:connect(function(Mouse)
Mouse.KeyDown:connect(growHum)
end)



The Equipped event of the Tool passes on the active mouse object. You can use the KeyDown event of this Mouse object to do what you want to do.

Please do remember that this is a LocalScript.
Report Abuse
ZeetZeet is not online. ZeetZeet
Joined: 01 May 2012
Total Posts: 179
14 Jun 2012 12:14 AM
@AgentFireFox

That was what I needed, thanks.

Thanks to everyone for helping me :3
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