Textbox input not working

I am making a library system, where players publish books for other players to read.

Whenever a player types in a Book title before they publish it my code to publish it receives this

{
                    ["ChangePlayerRank"] = "function",
                    ["GetAllPendingBooks"] = "function",
                    ["GetNextBookID"] = "function",
                    ["PublishPendingBook"] = "function",
                    ["RecordPendingBook"] = "function"
                 }

Then it tries to store this in a datastore which is not allowed.
I tried printing the value of the textbox before I call my publish book function, but it just returns what I actually typed into the textbox.
My function to publish the book:

local BookContent
local MetadataForm = script.Parent.Parent.Parent.MetadataForm
local LibraryService = require(game.ServerScriptService.LibraryService)
function SaveAndContinue(var)
	BookContent = script.Parent.Parent.BookEditor.ContentText
	if BookContent:len() < 10 then
		script.Parent.Parent.BookEditor.Text = "<b>Book Content must not be empty!</b>"
		return
	end
	script.Parent.Parent.Visible = false
	script.Parent.Parent.Parent.MetadataForm.Visible = true
end
function SaveAsPending()
	print(MetadataForm.BookTitle.ContentText)
	if MetadataForm.BookTitle.ContentText == '' then
		MetadataForm.BookTitle.Text = "<b>Title must not be empty!</b>"
		return
	end
	LibraryService:RecordPendingBook(MetadataForm.BookTitle.ContentText,BookContent)
	MetadataForm.Output.Visible = true
	MetadataForm.Output.Text = "<b>Book is now pending moderation!</b>"
	return
end
script.Parent.MouseButton1Click:Connect(SaveAndContinue)
MetadataForm.PublishButton.MouseButton1Click:Connect(SaveAsPending)

My module script to process the book:

function LibraryService.RecordPendingBook(BookName,Book)
	print(BookName)
	local BOOKID = LibraryService.GetNextBookID()
	print(BOOKID)
	PendingBookStore:SetAsync(BOOKID,BookName)
	BookStore:SetAsync(BOOKID,Book)
end
1 Like