Would Yandere Dev hire me?

Hey, so I’ve been working on some code to detect user input and was wondering if it was Yandere Dev worthy, if you know what I mean. What do you think?

Thanks! :slight_smile:

-- Function to handle key presses
local function onInputBegan(input, gameProcessed)
	-- Check if the input is a key press and not processed by the game
	if input.UserInputType == Enum.UserInputType.Keyboard and not gameProcessed then
		-- Detect specific keys
		if input.KeyCode == Enum.KeyCode.One then
			currentSlot = 1
		elseif input.KeyCode == Enum.KeyCode.Two then
			currentSlot = 2
		elseif input.KeyCode == Enum.KeyCode.Three then
			currentSlot = 3
		elseif input.KeyCode == Enum.KeyCode.Four then
			currentSlot = 4
		elseif input.KeyCode == Enum.KeyCode.Five then
			currentSlot = 5
		elseif input.KeyCode == Enum.KeyCode.Six then
			currentSlot = 6
		elseif input.KeyCode == Enum.KeyCode.Seven then
			currentSlot = 7
		elseif input.KeyCode == Enum.KeyCode.Eight then
			currentSlot = 8
		elseif input.KeyCode == Enum.KeyCode.Nine then
			currentSlot = 9
		elseif input.KeyCode == Enum.KeyCode.Zero then
			currentSlot = 0
		else
			print("Other key pressed: " .. tostring(input.KeyCode))
		end
	end
end
31 Likes

the script is fine but it can be more readable

rather than using many if statements you can add the keycodes into a table

you can annotate the function parameters to get autocompletion when typing

not necessarily but you can also exit the function if a condition is met it helps avoiding many nested if statments

example

-- Function to handle key presses

local currentSlot

local keysTable = {
	[Enum.KeyCode.One] = 1,
	[Enum.KeyCode.Two] = 2,
	[Enum.KeyCode.Three] = 3,
	[Enum.KeyCode.Four] = 4,
	[Enum.KeyCode.Five] = 5,
	[Enum.KeyCode.Six] = 6,
	[Enum.KeyCode.Seven] = 7,
	[Enum.KeyCode.Eight] = 8,
	[Enum.KeyCode.Nine] = 9,
	[Enum.KeyCode.Zero] = 0
}
local function onInputBegan(input :InputObject, gameProcessed :boolean)
	-- exit the function if gameProcessed is true or if input wasnot keyboard
	if gameProcessed or input.UserInputType ~= Enum.UserInputType.Keyboard then return end
	
	local slot = keysTable[input.KeyCode]
	if slot then
		currentSlot = slot
	else
		print("Other key pressed: " .. tostring(input.KeyCode))
	end
end
16 Likes

your script is the worst one i ever seen, try this one

local currentSlot = 0 or 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10

local function onInputBegan(input, gameProcessed)
	-- Check if the input is a key press and not processed by the game
	if input.UserInputType == Enum.UserInputType.Keyboard and not gameProcessed then
		-- Detect specific keys
		if input.KeyCode == Enum.KeyCode.One and true == true then
			
			currentSlot = tonumber(tostring(1))
		elseif input.KeyCode == Enum.KeyCode.Two and true == true then --this one set the currentSlot to number 2 (two)
			currentSlot = tonumber(tostring(1+1))
		elseif input.KeyCode == Enum.KeyCode.Three and true == true then --this one set the currentSlot to number 3 (three)
			currentSlot = tonumber(tostring(1+1+1))
		elseif input.KeyCode == Enum.KeyCode.Four and true == true then --this one set the currentSlot to number 4 (four)
			currentSlot = tonumber(tostring(1+1+1+1))
		elseif input.KeyCode == Enum.KeyCode.Five and true == true then --this one set the currentSlot to number 5 (five)
			currentSlot = tonumber(tostring(1+1+1+1+1))
		elseif input.KeyCode == Enum.KeyCode.Six and true == true then --this one set the currentSlot to number 6 (six)
			currentSlot = tonumber(tostring(1+1+1+1+1+1))
		elseif input.KeyCode == Enum.KeyCode.Seven and true == true then --this one set the currentSlot to number 7 (seven)
			currentSlot = tonumber(tostring(1+1+1+1+1+1+1))
		elseif input.KeyCode == Enum.KeyCode.Eight and true == true then --this one set the currentSlot to number 8 (eight)
			currentSlot = tonumber(tostring(1+1+1+1+1+1+1+1))
		elseif input.KeyCode == Enum.KeyCode.Nine and true == true then --this one set the currentSlot to number 9 (nine)
			currentSlot = tonumber(tostring(1+1+1+1+1+1+1+1))
		elseif input.KeyCode == Enum.KeyCode.Zero and true == true then --this one set the currentSlot to number 0 (zero)
			currentSlot = tonumber(tostring(1-1))
		else
			print("Other key pressed: " .. tostring(input.KeyCode))
		end
	end
end


this one is very optimized and works fine for me, probably the Yandere dev would accept it

19 Likes

no no the joke is yanderedev’s scripting is absolute spaghetti, unreadable at times

8 Likes

alright.i try my best to make an even worse code

5 Likes

What do you guys think of my input handler?

local Uis = game:GetService("UserInputService")
local IsCorrectInput

IsCorrectInput = function(Input)
	if IsCorrectInput(Input) then
		print("Attack")
	end
end

Uis.InputBegan:Connect(function(Input,Gpe)
	if not Gpe then
		IsCorrectInput(Input)
	end
end)
5 Likes

i made an even better one

local currentSlot = 0 or 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10
--the thing up here is a variable that is used in the function later yeah is cool
local trueBoolean = true and true or true
local function onInputBegan(input, gameProcessed) --this thing is a function with parameters
	-- Check if the input is a key press and not processed by the game
	if input.UserInputType == Enum.UserInputType.Keyboard and not gameProcessed then --this one is a logic thing, dont ask me
		-- Detect specific keys
	if input.KeyCode == Enum.KeyCode.One and trueBoolean == not false then --also this one is a logic thing
			--this one is an empty space
			currentSlot = tonumber(tostring(1)) -- this one set the currentSlot to number 1 (one)
	     elseif input.KeyCode == Enum.KeyCode.Two and not nil and trueBoolean == not false then --this thing is a logic thing too
			currentSlot = tonumber(tostring(1+1)) --this one set the currentSlot to number 2 (two)
    elseif input.KeyCode == Enum.KeyCode.Three and not nil and trueBoolean == not false then --this thing is a logic thing too
			currentSlot = tonumber(tostring(1+1+1)) --this one set the currentSlot to number 3 (three)
		    elseif input.KeyCode == Enum.KeyCode.Four and not nil and trueBoolean == not false then --this thing is a logic thing too
			currentSlot = tonumber(tostring(1+1+1+1)) --this one set the currentSlot to number 4 (four)
	        elseif input.KeyCode == Enum.KeyCode.Five and not nil and trueBoolean == not false then --this thing is a logic thing too
			currentSlot = tonumber(tostring(1+1+1+1+1)) --this one set the currentSlot to number 5 (five)
 elseif input.KeyCode == Enum.KeyCode.Six and not nil and trueBoolean == not false then --this thing is a logic thing too
			currentSlot = tonumber(tostring(1+1+1+1+1+1)) --this one set the currentSlot to number 6 (six)
	  elseif input.KeyCode == Enum.KeyCode.Seven and not nil and trueBoolean == not false then --this thing is a logic thing too
			currentSlot = tonumber(tostring(1+1+1+1+1+1+1)) --this one set the currentSlot to number 7 (seven)
			elseif input.KeyCode == Enum.KeyCode.Eight and not nil and trueBoolean == not false then --this thing is a logic thing too
			currentSlot = tonumber(tostring(1+1+1+1+1+1+1+1)) --this one set the currentSlot to number 8 (eight)
elseif input.KeyCode == Enum.KeyCode.Nine and not nil and trueBoolean == not false then --this thing is a logic thing too
			currentSlot = tonumber(tostring(1+1+1+1+1+1+1+1)) --this one set the currentSlot to number 9 (nine)
	elseif input.KeyCode == Enum.KeyCode.Zero and not nil and trueBoolean == not false then --this thing is a logic thing too
			currentSlot = tonumber(tostring(1-1)) --this one set the currentSlot to number 0 (zero)
			else
			print("Other key pressed: " .. tostring(input.KeyCode)) --if the key is not 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10, 
			--then will print to the console "Other key pressed" and the input of the key, which is not a number
		end --end
	end --end 2
end-- end 3


14 Likes

Ohhhh, I never thought of adding a bunch of “or” statements for no reason, and the random check to see if the bool value true is in fact true adds another layer of depth into the code.

Thanks for the optimization tip!

6 Likes

and you forgot to check if a variable is nil and is a number (this works only for numbers)!

5 Likes

Ohhh I didn’t think of that! Do you think I should keep indenting my code with “if” statements, rather than have "not"s with “return” inside of them?

5 Likes

i made a more readable and more optimized one

local ________________________________________ = game:GetService("UserInputService")
local _______________________________________________________ = function()
	return 0x022389218047962
end


________________________________________.InputBegan:Connect(function(_____________________________, _________________________________________________)
	if _____________________________.KeyCode == 0x025 then
		print(0x025)
	else
		local ____________________________________________________________ = math.random(0x005, 0x0125) == math.random(0x005, 0x0125) and (  (math.cos(math.random(0x005, 0x0125)) == math.sin(math.random(0x005, 0x0125)))) and true
		if ____________________________________________________________ then
			print(_______________________________________________________())
			local _____________________________________________________________________ = math.random(0x005, 0x09) == math.random(0x005, 0x099) and (  (math.cos(math.random(0x005, 0x0125)) == math.sin(math.random(0x005, 0x0125)))) and true
			if not _____________________________________________________________________ then
				return "error"
			end
		end
	end
end)
12 Likes

abosolutely! this will speed up your code so the Roblox engine will know what are you trying to achieve!

dont forget to add a loop that checks multiple times if a boolean value is true

for i = 1,1000,1 do
   if boolean == true then
     boolean = true
   end
end
9 Likes

I didn’t think of this, should I remove all the wait()'s in my loops as well?

5 Likes

i think this one is pretty unreadable, have you tried coding in malbolge?

4 Likes

yes
however brainf##k is a more readable version

++++++++++[>+++++++>++++++++++>+++<<<-]>++.>+.+++++++
 ..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.
6 Likes

of course, is very deprecated!

instead, try to pause the code by lagging the game!

3 Likes

Try this

-- Function to handle key presses with an absurd level of complexity
local function onInputBegan(input, gameProcessed)
	-- Check if the input is a key press and not processed by the game
	if input.UserInputType == Enum.UserInputType.Keyboard and not gameProcessed then
		-- Mapping key codes to their corresponding slot values
		local keyMap = {
			[Enum.KeyCode.One] = 1,
			[Enum.KeyCode.Two] = 2,
			[Enum.KeyCode.Three] = 3,
			[Enum.KeyCode.Four] = 4,
			[Enum.KeyCode.Five] = 5,
			[Enum.KeyCode.Six] = 6,
			[Enum.KeyCode.Seven] = 7,
			[Enum.KeyCode.Eight] = 8,
			[Enum.KeyCode.Nine] = 9,
			[Enum.KeyCode.Zero] = 0
		}

		-- Determine slot
		local function determineSlot(keyCode)
			for key, slot in pairs(keyMap) do
				if key == keyCode then
					return slot
				end
			end
			return nil -- Return nil if no match is found
		end

		-- Assign the slot value
		local slotDetermined = determineSlot(input.KeyCode)
		if slotDetermined ~= nil then
			-- Justify why this value is being assigned
			print("Assigning slot: " .. slotDetermined .. " because the key matched a predefined mapping.")
			currentSlot = slotDetermined
		else
			-- Fallback for unmatched keys
			print("Key not mapped to a slot. Input received: " .. tostring(input.KeyCode))
			currentSlot = -1 -- Assign value for unmatched keys
		end

		-- Add redundant confirmation logs to over-communicate the process
		print("Slot has been determined: " .. tostring(currentSlot))
		if currentSlot == -1 then
			print("No slot corresponds to the pressed key. Awaiting further input.")
		end
	else
		-- Handle non-keyboard inputs for no reason
		print("Input ignored because it is either processed by the game or not a keyboard input.")
	end

	-- Perform additional logging to simulate a deep AI thought process
	local randomThoughts = {
		"Why do we even press keys?",
		"Keyboards are the unsung heroes of communication.",
		"What if the user wanted slot 11? Should we invent a new key?",
		"Is 'Zero' truly the absence of a slot or the start of everything?",
	}
	print(randomThoughts[math.random(1, #randomThoughts)])
end
9 Likes

else if

2 Likes

alright excuse me for breathing the same air as yours

6 Likes

What you mean by it joking right so here is a code is I make.

local Plantgreen = Game.Workspace.Plants.Plantgreen
local Plantnormal = Game.Workspace.Plants = Plantnormal

While true do
wait(40)
Plantgreen:clone()
end

Do clones

And is how you making a coding I learned

5 Likes