So I’m making a radio, and when people press Enter, I want to check if they’re focused and typing in the radio to send their message. But when they press Enter (Enum.KeyCode.Return which is annoying and it took me a good minute to figure out), it unFocuses them from the TextBox (TextBox:IsFocused() ). So I’m creating an attribute, and then setting that attribute, so from another script, I can use PropertyGetChangedSignal instead of using a while wait loop, which is : (.
But the issue is, it can’t seem to edit and/or detect the property that I added.
game:GetService("RunService").RenderStepped:Connect(function()
if script.Parent:IsFocused() then
script.Parent.IsFocused = true --I'm sure this would also error, but didn't try and/or focus it.
else
script.Parent.IsFocused = false --Error on this line
end
end)
Very simple script. The script is child of the TextBox
Is this a roblox issue, because it seems it is, and do please help. (Or I could use a boolValue as a child but that’s annoying.) Anywho, thoughts would be appreciated.
Nononono. :IsFocused is also a function of TextBox. I just created my own attribute so I don’t have to use a while wait loop. I can’t use GetPropertyChangedSignal on a function. The issue is that it doesn’t detect that attribute.
Curious, but why aren’t you using Focused and FocusLost? If you want to commit actions based on the user’s focus on a TextBox then there are already events staring at you in the face for an event-driven system. As for typing, if you need effects to occur while the user is typing you can check if the Text property changes.
Not sure what the point of using RunService is - and you’re using RenderStepped no less, which you shouldn’t be using unless you really need your action to occur before frames render and this is not such a case. There are rare circumstances where RenderStepped is appropriate, like updating camera CFrames or character properties.