TextBox Keeping Text Issue

  1. What do you want to achieve?
    For the TextBox not delete the text every time it gets exited and clicked.

  2. What is the issue?
    Every time someone clicks off (not enter) and clicks back on the text resets
    robloxapp-20220509-1802430.wmv (521.0 KB)

  3. What solutions have you tried so far?
    I tried removing the script entirely and nothing changed

script.Parent.FocusLost:Connect(function(enterpressed)
	if enterpressed == true then
		game:GetService("ReplicatedStorage").Events.EventSend:InvokeServer(game:GetService("Players").LocalPlayer, script.Parent.Text)
		script.Parent.Text = ""
	end
end)
script.Parent.ClearTextOnFocus = true

Just use this script or change the ClearTextOnFocus property of the TextBox to true.

1 Like

You made a mistake on this line… the player is automatically defined in the OnServerInvoke function so there is no need to include the player parameter while invoking the server.

You can replace the script with this below

script.Parent.FocusLost:Connect(function(enterpressed)
	if enterpressed == true then
		game:GetService("ReplicatedStorage").Events.EventSend:InvokeServer(script.Parent.Text)
		script.Parent.Text = ""
	end
end)

I need the player to use on the server, regardless.