Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How would i detect the player finishing typing in a TextBox?

What i tried is:

local player = game.Players.LocalPlayer
local seconds = game.ReplicatedStorage.seconds
local TextBox = script.Parent
TextBox:GetPropertyChangedSignal("Text"):Connect(function()
	if script.Parent.FocusLost then
		seconds.Value = script.Parent.Text
	end
end)

but it instantly changes the intValue of seconds

2 answers

✓ Accepted answer

So you need to do something else with the script other than that. this is the other part. this will fire when you click enter or click out of the box:

local player = game.Players.LocalPlayer
local seconds = game.ReplicatedStorage.seconds
local TextBox = script.Parent
TextBox.FocusLost:Connect(function()
	if script.Parent.FocusLost then
		seconds.Value = script.Parent.Text
	end
end)

Happy to help, b_mni.

2 comments

0

That code has an error

0

ik

You could use TextBox.FocusLost (an event not a property) which fires whenever someone pressed enter or clicks away from the text box and they are no longer typing.

TextBox.FocusLost:Connect(function()
	seconds.Value = script.Parent.Text
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.