[SOLVED] Switching to New Line Notebook System Issue

I am currently trying to make a notebook style system that kills a player if their name is typed into the notebook line (textbox) and then the available line moves down to the next line continuously until they run out of room and have to switch the page for a new set of available lines they can use.

image

I already have a textbox for every line. So, I really don’t want to have to resort to placing a local script in every notebook line (textbox) for obvious reasons.

This is my current code and it is not working. How would I switch to the next line in the notebook effciently

local UIS = game:GetService("UserInputService")
local lineNum = 1
local currentLine = script.Parent:FindFirstChild("Line"..lineNum)

UIS.InputBegan:Connect(function(input,GPE)
	if input.KeyCode == Enum.KeyCode.Return then
		lineNum = lineNum + 1
		currentLine.PlaceholderText = "Write the person's name here..."
		currentLine.TextEditable = false
		
		local h = game.Workspace:FindFirstChild(currentLine.Text).Humanoid
		if h then
			script.KillPlayer:FireServer(h)
			currentLine.TextColor3 = Color3.new(170,0,0)
			wait(.5)
			currentLine.TextColor3 = Color3.new(0,0,0)
			else print("Character not found.")
		end
	end
end)

You can make the player focus on the text box here link . You could also disable the previous line or turn it into a textlabel

You’re changing the text back before you get the humanoid. That’s why it’s not working.

local UIS = game:GetService("UserInputService")
local lineNum = 1
local currentLine = script.Parent:FindFirstChild("Line"..lineNum)

UIS.InputBegan:Connect(function(input,GPE)
	if input.KeyCode == Enum.KeyCode.Return then
		local h = game.Workspace:FindFirstChild(currentLine.Text).Humanoid

		lineNum = lineNum + 1
		currentLine.PlaceholderText = "Write the person's name here..."
		currentLine.TextEditable = false
		
		if h then
			script.KillPlayer:FireServer(h)
			currentLine.TextColor3 = Color3.new(170,0,0)
			wait(.5)
			currentLine.TextColor3 = Color3.new(0,0,0)
			else print("Character not found.")
		end
	end
end)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.