I have a TextBox in a SurfaceGui (in a part of course) in workspace. I want the input from the TextBox to be processed into a value and put in a ReplicatedStorage Value (instance).
I have tried SO many solutions - FocusLost, Events, Changed, LocalScript/Script and nothing seems to be working.
How would I do this?
If anything is unclear, please let me know!
So if i’m correct, you wanna convert text to value?
you can do tonumber(TextBox.Text) or tostring(TextBox.Text)
--number
local TextBox = -- path to textbox
local Value = -- path to ur value
TextBox.FocusLost:Connect(function(gp)
if gp then
Value.Value = tonumber(TextBox.Text)
end
end)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local textBox = path_to_textbox
local value = ReplicatedStorage.Value
textBox.FocusLost:Connect(function()
value.Value = textBox.Text
end)
Tried already aswell. Nothing seemed to be picked up or anything though. I placed a bunch of print functions all over but weirdly enough, there still were no in the output log.
local event = game.ReplicatedStorage.PlaneStats.Update
event.OnServerEvent:Connect(function(text)
game.ReplicatedStorage.PlaneStats.PlaneInfo.TailNumber.Value = tostring(text)
end)
Sends the Event (in the textbox in surfacegui)
local value = game:GetService("ReplicatedStorage").PlaneStats.PlaneInfo.TailNumber
local text = script.Parent.Text
script.Parent.FocusLost:Connect(function()
game:GetService("ReplicatedStorage").PlaneStats.Update:FireServer(text)
end)
I believe the SurfaceGui has to be in the PlayerGui (so you put it in StarterGui) in order for it to work. You then just have to set the adornee to the part you want, which can be done in the properties tab.
Note that you have to record the value of the textbox with a local script and send it to the server with a remote.