I am trying to make it so whatever the client has written on his textbox when the client presses the button the textbox’s text is fired to the server.
My problem is that i cant fire it because its nil for the server, Anybody got a solution?
I am trying to make it so whatever the client has written on his textbox when the client presses the button the textbox’s text is fired to the server.
My problem is that i cant fire it because its nil for the server, Anybody got a solution?
When you fire it, just pass the TextBox.Text
in the paramter
Pass the Text
property of the TextBox object when calling RemoteEvent:FireServer()
and pick it up via a listener on the server, e.g
--// Script @ game.ServerScriptService
local remote = RemoteEvent;
remote.OnServerEvent:Connect(print)
--// callback there, using print would just pass function print as the callback - printing arguments to output (the player object tostring'ed and the rest you pass explicitly)
--// though you might want to do more than just log parameters, try creating your own function and utilize them
My pcall returns an error.
the error is: nil
ive already stated that ive passed it as a parameter the server cant recognize it.
“My problem is that i cant fire it because its nil for the server, Anybody got a solution?”
Could you show the code you are using, please?
More likely that it’s not nil for the server and that’s an error on your side, you send a string to the server and the server receives it - what you do in between is what’s flawed.
At the very least, the full error pasted could help us better diagnose your issue (unless now there’s one-word errors).
Without showing your code/ how your system is designed the best anyone can do is demonstrate what to do, to see where your structure is faulted we need to see it first.
Hello, I leave you an example of how you can send from a GUI through remote Events to the server.
The code:
-- ServerScript
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local REText = ReplicatedStorage:WaitForChild("REText")
local TextLabel = script.Parent.TextLabel
game.ReplicatedStorage.REText.OnServerEvent:Connect(function(player, text)
TextLabel.Text = text
end)
-- LocalScript
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local REText = ReplicatedStorage:WaitForChild("REText")
local ScreenGui = script.Parent
local TextButton = ScreenGui.TextButton
local TextBox = ScreenGui.TextBox
script.Parent.TextButton.MouseButton1Click:Connect(function()
REText:FireServer(TextBox.Text)
end)
Also the file with the example Example.rbxl (29,2 KB)