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
 

Re: Press A Key

Previous Thread :: Next Thread 
iiNemo is online. iiNemo
Joined: 22 Jul 2013
Total Posts: 2380
23 Apr 2017 01:03 PM
local Plr = game.LocalPlayer local Mouse = Plr:GetMouse() local PutAwayTime = false Mouse.KeyDown:connect(function(key) if key == 'q' then print('hi') for i,v in pairs (Plr.Backpack:GetChildren()) do if v.ClassName == 'Tool' then if PutAwayTime == false then v:Clone().Parent = Plr.Character v:Remove() PutAwayTime = true end end end for ### ## pairs (Plr.Character:GetChildren()) do if g.ClassName == 'Tool' then if PutAwayTime == true then g:Clone().Parent = Plr.Backpack g:Remove() PutAwayTime = false end end end end end) Why Exactly does this do Absolutely Nothing?
Report Abuse
iiNemo is online. iiNemo
Joined: 22 Jul 2013
Total Posts: 2380
23 Apr 2017 01:04 PM
local Plr = game.LocalPlayer local Mouse = Plr:GetMouse() local PutAwayTime = false Mouse.KeyDown:connect(function(key) if key == 'q' then print('hi') for i,v in pairs (Plr.Backpack:GetChildren()) do if v.ClassName == 'Tool' then if PutAwayTime == false then v:Clone().Parent = Plr.Character v:Remove() PutAwayTime = true end end end for ### ## pairs (Plr.Character:GetChildren()) do if g.ClassName == 'Tool' then if PutAwayTime == true then g:Clone().Parent = Plr.Backpack g:Remove() PutAwayTime = false end end end end end) -- Why Exactly does this do Absolutely Nothing?
Report Abuse
iiNemo is online. iiNemo
Joined: 22 Jul 2013
Total Posts: 2380
23 Apr 2017 01:04 PM
local Plr = game.LocalPlayer
local Mouse = Plr:GetMouse()
local PutAwayTime = false
Mouse.KeyDown:connect(function(key)
if key == 'q' then
print('hi')
for i,v in pairs (Plr.Backpack:GetChildren()) do
if v.ClassName == 'Tool' then
if PutAwayTime == false then
v:Clone().Parent = Plr.Character
v:Remove()
PutAwayTime = true
end
end
end
for m, n in pairs (Plr.Character:GetChildren()) do
if g.ClassName == 'Tool' then
if PutAwayTime == true then
n:Clone().Parent = Plr.Backpack
n:Remove()
PutAwayTime = false
end
end
end
end
end)
Report Abuse
iiNemo is online. iiNemo
Joined: 22 Jul 2013
Total Posts: 2380
23 Apr 2017 01:04 PM
Why does this do absolutely nothing lol
Report Abuse
LaeMVP is online. LaeMVP
Joined: 24 Jun 2013
Total Posts: 4416
23 Apr 2017 01:05 PM
KeyDown is deprecated, use UserInputService.
Report Abuse
iiNemo is online. iiNemo
Joined: 22 Jul 2013
Total Posts: 2380
23 Apr 2017 01:06 PM
I tried userinput service first and it didn't owrk
Report Abuse
Cyrakohl is not online. Cyrakohl
Joined: 09 Nov 2014
Total Posts: 3197
23 Apr 2017 01:06 PM
game:GetService("UserInputService").InputBegan:connect(function(Input)

if Input.KeyCode = Enum.KeyCode.E then
workspace.Baseplate:Destroy()

end
end)


Report Abuse
iiNemo is online. iiNemo
Joined: 22 Jul 2013
Total Posts: 2380
23 Apr 2017 01:10 PM
local Plr = game.LocalPlayer
local PutAwayTime = false
game:GetService("UserInputService").InputBegan:connect(function(Input)
if Input.KeyCode == Enum.KeyCode.Q then
print('hi')
for i,v in pairs (Plr.Backpack:GetChildren()) do
if v.ClassName == 'Tool' then
if PutAwayTime == false then
v:Clone().Parent = Plr.Character
v:Remove()
PutAwayTime = true
end
end
end
for m, n in pairs (Plr.Character:GetChildren()) do
if n.ClassName == 'Tool' then
if PutAwayTime == true then
n:Clone().Parent = Plr.Backpack
n:Remove()
PutAwayTime = false
end
end
end
end
end)

-- Nothing Happens..
Report Abuse
LordDracius is online. LordDracius
Joined: 22 Oct 2011
Total Posts: 1056
23 Apr 2017 01:11 PM
local Plr=game.Players.LocalPlayer
Report Abuse
iiNemo is online. iiNemo
Joined: 22 Jul 2013
Total Posts: 2380
23 Apr 2017 01:13 PM
It hurts when I see that ;(
Report Abuse
iiNemo is online. iiNemo
Joined: 22 Jul 2013
Total Posts: 2380
23 Apr 2017 01:15 PM
local Plr = game.Players.LocalPlayer
local PutAwayTime = false
game:GetService('UserInputService').InputBegan:connect(function(Input)
if Input.KeyCode == Enum.KeyCode.Q then
for i,v in pairs (Plr.Backpack:GetChildren()) do
if v.ClassName == 'Tool' then
if PutAwayTime == false then
v:Clone().Parent = Plr.Character
v:Remove()
PutAwayTime = true
end
end
end
for m, n in pairs (Plr.Character:GetChildren()) do
if n.ClassName == 'Tool' then
if PutAwayTime == true then
n:Clone().Parent = Plr.Backpack
n:Remove()
PutAwayTime = false
end
end
end
end
end)


-- Still tho why doesn't this work, there is a tool in the players backpack... Are u like not allowed to clone stuff from a players backpack?
Report Abuse
iiNemo is online. iiNemo
Joined: 22 Jul 2013
Total Posts: 2380
23 Apr 2017 01:21 PM
??
Report Abuse
LordDracius is online. LordDracius
Joined: 22 Oct 2011
Total Posts: 1056
23 Apr 2017 01:36 PM
-- Your old script was putting the tools away instantly

local Plr = game.Players.LocalPlayer
local PutAwayTime = false
game:GetService('UserInputService').InputBegan:connect(function(Input)
if Input.KeyCode == Enum.KeyCode.Q then
for i,v in pairs (Plr.Backpack:GetChildren()) do
if v.ClassName == 'Tool' then
if PutAwayTime == false then
v:Clone().Parent = Plr.Character
v:Remove()
end
end
end
for m, n in pairs (Plr.Character:GetChildren()) do
if n.ClassName == 'Tool' then
if PutAwayTime == true then
n:Clone().Parent = Plr.Backpack
n:Remove()
end
end
end
PutAwayTime=not PutAwayTime -- Makes PutAwayTime the opposite.
end
end)
Report Abuse
iiNemo is online. iiNemo
Joined: 22 Jul 2013
Total Posts: 2380
23 Apr 2017 01:38 PM
Ah, thx a lot!
Report Abuse
LaeMVP is online. LaeMVP
Joined: 24 Jun 2013
Total Posts: 4416
23 Apr 2017 01:42 PM
:Remove() is also deprecated.
Report Abuse
EmoteAblaze is not online. EmoteAblaze
Joined: 07 Oct 2014
Total Posts: 244
23 Apr 2017 01:55 PM
my brain hurts
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