So ive been using remote events for a bit but now ive been wanting to learn how todo this:
So basically i wanna learn how detect the text that the remote event “made”
heres my localscript that fires the remote:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("Login")
local TextThing = "Hello"
script.Parent.MouseButton1Click:Connect(function()
remoteEvent:FireServer(TextThing)
end)
i wanna have a server script that will read what the remote text is… but idk how todo that, pls help lolol…
1 Like
Hi,
So new to events? I show you how a server can get its signal
Like this:
Put this code in the server script and see if it will print the TextThing
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("Login")
remoteEvent.OnServerEvent:Connect(function(player,TextThing) -- When the event fires, then this function will detect that call.
print(TextThing)
end)
Problems? Questions?
If you need more information about RemoteEvents, I suggest you to look at offical Roblox Forums or AlvinBlox as he makes a series of the most crucial things in making roblox games such as RemoteEvents/RemoteFunctions/BindableEvent/BindableFunction
Happy to help.
1 Like
Did this help your troubles? Mark Solution if your issue was resolved, otherwise ask what else went wrong.
When you send a signal to the server with :FireServer(), all arguments inside the “()” are sent as well.
Ex. (Local Script)
local remote = game.ReplicatedStorage:WaitForChild("RemoteEvent")
local myText = "Hello, this is my text."
remote:FireServer(myText) --Will send the Player (always first) and myText
Because I put “myText” inside the “()” when firing the server, that will be passed along to the server.
Note: You don’t have to put “Player” when firing the server, it’s automatic.
Ex. (Server Script)
local remote = game.ReplicatedStorage:WaitForChild("RemoteEvent")
remote.OnServerEvent:Connect(function(Player, SentText) -- "Player" is first because it automatically sets the player who fired the remote event as the FIRST parameter.
print(SentText)
end)
This will print “Hello, this is my text.” Hope this helped 