So I have been trying to make it so a player could change what an NPC says using a TextBox. This is my final code; it still does not work, would like some help. -edit- This is code for a textbutton which would submit the TextBox input and evoke the NPC to say what the user put in the TextBox (but it doesnt work)

local chat = game:GetService("Chat")
local head = game.Workspace["testing SS NPC"].Head


local player = game.Players.LocalPlayer

script.Parent.Parent.TextBox.FocusLost:connect(function(enterPressed)
    if enterPressed and script.Parent.Parent.TextBox.Text == script.Parent.Parent.TextBox.Text then
        chat:Chat(head, "serverside input:"..script.Parent.Parent.TextBox.Text, "Red")
    end
end)