Local client and server do not detect the text from the UI

I am making a code system and when I started I found this error:

The local client, Server client, PlayerGUI, does not detect the text of the TextBox

Button Script:

local Event = game.ReplicatedStorage.CodeSystem.GetUI
local CodeBox = script.Parent.Parent.Parent.CodeBox.Text

script.Parent.MouseButton1Click:Connect(function()
print(CodeBox)
Event:FireServer(CodeBox)
end)

ServerScript:

local Event = game.ReplicatedStorage.CodeSystem.GetUI

    Event.OnServerEvent:Connect(function(Player, CodeBox)
    print(CodeBox)

    --PlayerGui
    local PlayerGui = Player.PlayerGui.CodeSystem.CodeBox
    print("PlayerGui"..PlayerGui.Text)
    end)


If someone could help me I will be very grateful!

You used script.Parent.Parent.Parent.CodeBox.Text as a variable, meaning it will stay constant.
Change it to script.Parent.Parent.Parent.CodeBox and reference it below by adding .Text

Thanks!, I did not know that this caused it
this works! :slight_smile: