Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Having problems with separating different actions? (complicated question)

So basically I have all in one script a few moves that are all functional, the problem is that I can't use them for a reason I can't determine.

What I mean is I have 3 actions in the script, 2 are single moves, and 1 is a combo. The single moves are "R" and "T", while the combo is "Q", every move works, the problem is that "Q" doesn't work when I put it at the bottom of the script, and if I put it at the top of the script "R" and "T" don't work. (And I don't get any error messages, meaning I think it might have something to do with the way I return the script.)

I'm using the KeyDown function and not UserInputService for the "Q" combo. If I need to elaborate on anything else, tell me. (Also it was very late for me when I wrote this so if this is hard to read I blame it on that.)

function onKeyDown(key)
key = key:lower()

		if key == "q" then	
	butpress = butpress + 1
	if butpress == 1 then
		
				
		
		enabled = true
		
		print("Q 1")
		
		wait(2)
		if butpress == 1 then
			butpress = 0
			return
		end
	end
	
	
	if butpress == 2 then
		enabled = true
		
		print ("Q 2")
		
		wait(1)
		
		
		if butpress == 2 then 
				butpress = 0
			return
		end
	end	
	
	
	if butpress == 3 then 
		enabled = true
		print ("Q 3")
		

		wait(2)
		wait(0.7)
		if butpress == 3 then 
				butpress = 0
			return
		end
	end

mouse.KeyDown:connect(onKeyDown)

The reason I'm only showing you "Q" is because "R" and "T" work fine together but Q doesn't, and I think it has something to do with how I wrote it. -Thanks in advance

1 comment

1

You should not be using the key event of the mouse, use the http://wiki.roblox.com/index.php?title=API:Class/UserInputService

1 answer

Anyway, I found the answer later down the road, so I'm good.

This discussion is preserved as it was. New answers, comments, and votes are closed.