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

Why isn't this keyboard input line of code working?

Basically all I want it to do is add 1 to the value of power when one of the shift buttons are pressed yes I have called the mouse. Help please?

function powers(key)
	print("KEY DOWN"..key)	
	
	if key == "q" then
		
	end
	if key == "e" then
		
	end
	if string.byte(key) == 017 or 016 then
		while wait() do 
			if power.Value ~= 100 then
				power.Value = power.Value +1
			end
		end
	end
end
mouse.KeyDown:connect(powers)

1 answer

On line 10, nice try. You can't do this:

if string.byte(key) == 017 or 016 then -- You have to restate the statement.

Correct:

if string.byte(key) == 017 or string.byte(key) == 016 then 

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