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: KeyDown() help

Previous Thread :: Next Thread 
Fadeless is not online. Fadeless
Joined: 02 Jun 2013
Total Posts: 2046
21 Aug 2014 03:51 AM
In a localscript, this is what I have. (this is only one part of it)

plrmouse.KeyDown:connect(function(key)
if key == "q" then
if not open then
script.Parent.button_frame.shop_button:TweenPosition(UDim2.new(0, -200, 0, 250), "Out", "Sine", nil, true)
script.Parent.button_frame.guide_button:TweenPosition(UDim2.new(0, -55, 0, 150), "Out", "Sine", nil, true)
script.Parent.shop:TweenPosition(UDim2.new(0, 0, 0, 1500), "Out", "Sine", 0.7, true)
script.Parent.guide:TweenPosition(UDim2.new(0, 0, 0, -10), "Out", "Sine", 0.7, true)
open = true
return end
if key == "q" then
if open then
script.Parent.guide:TweenPosition(UDim2.new(0, 0, 0, 1500), "Out", "Linear", 1.5, true)
script.Parent.button_frame.guide_button:TweenPosition(UDim2.new(0, -200, 0, 150), "Out", "Sine", nil, true)
open = false
end end end end)

After pressing the q key, a guide frame would pop up.

+=+=+=+=+

When having the guide frame, up, it would take the user to double tap the e key to open up the shop, and close the guide frame.

plrmouse.KeyDown:connect(function(key)
if key == "e" then
if not open then
script.Parent.button_frame.shop_button:TweenPosition(UDim2.new(0, -55, 0, 250), "Out", "Sine", nil, true)
script.Parent.button_frame.guide_button:TweenPosition(UDim2.new(0, -200, 0, 150), "Out", "Sine", nil, true)
script.Parent.guide:TweenPosition(UDim2.new(0, 0, 0, 1500), "Out", "Linear", 0.7, true)
script.Parent.shop:TweenPosition(UDim2.new(0, 0, 0, -10), "Out", "Sine", 0.7, true)
open = true
return
end
if key == "e" then
if open then
script.Parent.shop:TweenPosition(UDim2.new(0, 0, 0, 1500), "Out", "Linear", 1.5, true)
script.Parent.button_frame.shop_button:TweenPosition(UDim2.new(0, -200, 0, 250), "Out", "Sine", nil, true)
open = false
end end end end)

+=+=+=+=+

Any help?
Report Abuse
XperialTheory is not online. XperialTheory
Joined: 06 Jul 2014
Total Posts: 41
21 Aug 2014 04:07 AM
wait what?? Explain what you want it to do and what is not working noone here is a mind reader
Report Abuse
Fadeless is not online. Fadeless
Joined: 02 Jun 2013
Total Posts: 2046
21 Aug 2014 03:22 PM
So you're saying you did not see my explanation on what it does, and what's wrong with?

It's in the post. Please read it carefully.
Report Abuse
Fadeless is not online. Fadeless
Joined: 02 Jun 2013
Total Posts: 2046
21 Aug 2014 03:41 PM
b1
Report Abuse
Bobobob12 is not online. Bobobob12
Joined: 23 Jan 2008
Total Posts: 5350
21 Aug 2014 03:43 PM
You're explaining what's happening or you're explaining the intended result. I can't tell which it is.
Report Abuse
Fadeless is not online. Fadeless
Joined: 02 Jun 2013
Total Posts: 2046
21 Aug 2014 03:46 PM
When having the guide frame up, it would take the user to double tap the e key to open up the shop, and close the guide frame.

^^^

So when pressing q, a guide will come up.

After doing so, it would take the user to double tap the e key in order to open up the shop, and close the guide.

Is there a way to fix it, so it would take the user to tap the e key only once?
Report Abuse
Fadeless is not online. Fadeless
Joined: 02 Jun 2013
Total Posts: 2046
21 Aug 2014 05:38 PM
b2
Report Abuse
Fadeless is not online. Fadeless
Joined: 02 Jun 2013
Total Posts: 2046
21 Aug 2014 06:08 PM
b3
Report Abuse
Fadeless is not online. Fadeless
Joined: 02 Jun 2013
Total Posts: 2046
21 Aug 2014 08:52 PM
b4

so, this one's going to be ignored again like my other post that i made 4 weeks ago?
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
21 Aug 2014 09:00 PM
plrmouse.KeyDown:connect(function(key)
if key == "q" then
if not open then
script.Parent.button_frame.shop_button:TweenPosition(UDim2.new(0, -200, 0, 250), "Out", "Sine", nil, true)
script.Parent.button_frame.guide_button:TweenPosition(UDim2.new(0, -55, 0, 150), "Out", "Sine", nil, true)
script.Parent.shop:TweenPosition(UDim2.new(0, 0, 0, 1500), "Out", "Sine", 0.7, true)
script.Parent.guide:TweenPosition(UDim2.new(0, 0, 0, -10), "Out", "Sine", 0.7, true)
open = true
else
script.Parent.guide:TweenPosition(UDim2.new(0, 0, 0, 1500), "Out", "Linear", 1.5, true)
script.Parent.button_frame.guide_button:TweenPosition(UDim2.new(0, -200, 0, 150), "Out", "Sine", nil, true)
open = false
end
elseif key == "e" then
if not open then
script.Parent.button_frame.shop_button:TweenPosition(UDim2.new(0, -55, 0, 250), "Out", "Sine", nil, true)
script.Parent.button_frame.guide_button:TweenPosition(UDim2.new(0, -200, 0, 150), "Out", "Sine", nil, true)
script.Parent.guide:TweenPosition(UDim2.new(0, 0, 0, 1500), "Out", "Linear", 0.7, true)
script.Parent.shop:TweenPosition(UDim2.new(0, 0, 0, -10), "Out", "Sine", 0.7, true)
open = true
else
script.Parent.shop:TweenPosition(UDim2.new(0, 0, 0, 1500), "Out", "Linear", 1.5, true)
script.Parent.button_frame.shop_button:TweenPosition(UDim2.new(0, -200, 0, 250), "Out", "Sine", nil, true)
open = false
end
end
end)


Oplz. Use "Else" and "Elseif" instead of that unorganized mess.
I fixed the organization problem, but I don't know what the error is.

You didn't tell us the output, if any, and you didn't tell us how it behaves. "Here's my code, here's what I want it to do, fix it" doesn't work. We won't re-write your code completely, we will only find the error. But we don't know how it is behaving... I mean, we might be able to test it, but it won't be the same, and it would use our time.
Report Abuse
ZQFMGB12 is not online. ZQFMGB12
Joined: 07 Aug 2010
Total Posts: 208
21 Aug 2014 09:01 PM
Why are there two 'plrmouse.KeyDown:connect(function(key)'s ? You only need one.
Report Abuse
Fadeless is not online. Fadeless
Joined: 02 Jun 2013
Total Posts: 2046
21 Aug 2014 09:02 PM
Then help me simplify it.
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
21 Aug 2014 09:03 PM
I already simplified it.
Report Abuse
Fadeless is not online. Fadeless
Joined: 02 Jun 2013
Total Posts: 2046
21 Aug 2014 09:04 PM
@jarod

> You didn't tell us the output, if any, and you didn't tell us how it behaves.

there aren't any.

Also, thanks.
Report Abuse
Fadeless is not online. Fadeless
Joined: 02 Jun 2013
Total Posts: 2046
21 Aug 2014 09:07 PM
The script didn't help.

It did work- but nothing changed. the player still needs to double tap the e key to open up the shop.
Report Abuse
ZQFMGB12 is not online. ZQFMGB12
Joined: 07 Aug 2010
Total Posts: 208
21 Aug 2014 09:10 PM
why double tap e? why not just single tap?
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
21 Aug 2014 09:14 PM
local open = false

Put that at the top and test.
Report Abuse
Fadeless is not online. Fadeless
Joined: 02 Jun 2013
Total Posts: 2046
21 Aug 2014 09:16 PM
nope.
Report Abuse
Fadeless is not online. Fadeless
Joined: 02 Jun 2013
Total Posts: 2046
22 Aug 2014 11:26 AM
b5
Report Abuse
Fadeless is not online. Fadeless
Joined: 02 Jun 2013
Total Posts: 2046
22 Aug 2014 11:27 AM
@ZQF

No, the error is that it requires e to be tapped twice in order for the shop to come up.

I need it so it does the opposite.
Report Abuse
ZQFMGB12 is not online. ZQFMGB12
Joined: 07 Aug 2010
Total Posts: 208
22 Aug 2014 11:52 AM
Can you write me a pseudo code? I think I might see a logical error, but I am having trouble figuring out what the TweenPositions are doing to your guis. To re-write it, just re-write the entire code and replace the lines with :TweenPosition to something like 'Gui A move on screen', 'Gui B move out of the screen,' etc. (replace Gui A and Gui B with a description of your gui)
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