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)
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)