Either you can use a remote function (as suggested above, which is also what I personally recommend) or if you really want to use remote events then you can do the following:
Server
local RemoteEvent = Instance.new("RemoteEvent", game:GetService("ReplicatedStorage"))
RemoteEvent.OnServerEvent:Connect(function(Player, WhateverYouSent)
--Do stuff with whatever you sent.
RemoteEvent:FireClient(Player, "Something else")
end)
Client
local RemoteEvent = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")
RemoteEvent:FireServer("Some Info")
RemoteEvent.OnClientEvent:Wait() --Will wait until server responds.
print("Done!")
How could I get the info the server is sending back?
And, lets say I have the FireAllClients() part in an if statement, and then the clients send info to another script and that script sends back a FireServer() thing and it waits for the server to respond, before continuing.
Changed it to save the information it gets from the server.
Server
local RemoteEvent = Instance.new("RemoteEvent", game:GetService("ReplicatedStorage"))
RemoteEvent.OnServerEvent:Connect(function(Player, WhateverYouSent)
--Do stuff with whatever you sent.
RemoteEvent:FireClient(Player, "Something else")
end)
Client
local RemoteEvent = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")
RemoteEvent:FireServer("Some Info")
local Result = RemoteEvent.OnClientEvent:Wait() --Will wait until server responds.
print(Result)