Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How a script can see the text of a textbox?

Asked by 5 years ago

How i can use a script to detect the text of a textbox?, because when i put a text the script dont see it and only localscripts works.

It uses remote events or remote functions?, how i can use them?.

i only have this :

game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(player)
    workspace.GameTeleport.Tele.ClickDetector.Script.GameId.Value = player.PlayerGui.TextBox:GetPropertyChangedSignal("Text")
end)
0
do you want to change the text in the texbox? Vortex_Vasne 89 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

Improvements

You need a Server and Local Script in order to use RemoteEvents properly

Use WaitForChild() to make sure an instance exists before using it

You can pass the TextBox 's Text Property to the Server as a parameter in the OnServerEvent

Issues

GetPropertyChangedSignal() is an event, and thus cannot be used to give a value in the way you are attempting

Local Script (under StarterGui)

local remote = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")
local startgui = script.Parent
local box = startgui:WaitForChild("TextBox")

box:GetPropertyChangedSignal("Text"):Connect(function()
    remote:FireServer(box.Text)
end)

Server Script (under Server Script Service)

local remote = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")
local part = workspace:WaitForChild("GameTeleport"):WaitForChild("Tele")
local val = part:WaitForChild("ClickDetector"):WaitForChild("Script"):WaitForChild("GameId")

remote.OnServerEvent:Connect(function(player, text)
    val.Value = text
end)
Ad

Answer this question