I need it so I can set information’s to players GUi card. Like this, but it would show just on other client. And submit frame only show to certain players
I see. You can use RemoteEvents to tell the server your register information. I’m assuming theres some sort of system set in place to where the server knows which players need what information. So the server can then just tell the player the information you sent. If there isn’t, then the client can say which player they want to send the register information to.
You could also technically do this two other ways.
Client Automation
This way, you can have the client tell the server your card info, and then every other client will be able to read it when they want to, without the server giving them a personal invitation to read it. This method will be the most efficient, and the most clean. However, it is not good if you don’t want everybody to have the ability to read it.
Client > Server > Client
This way, the client tells the server their card info, and which player they want to send it to. It is slightly messier, but it is more secure, since only one other player can read the card info.
These are being changed locally, the server has no idea about these changes. So the data will appear empty to the server and the other client getting the information.
local RS = game.ReplicatedStorage
local player = game.Players.LocalPlayer
send.MouseButton1Click:Connect(function()
RS.PlayerCardSubmited:FireServer({
Reciever = patientName.Text,
Problem = patientProblem.Text,
})
end)
RS.PlayerCardSubmited.OnClientEvent:Connect(function(info, sender)
if sender != player then
player.PlayerGui:WaitForChild("PatientCard").Frame.PatientProblemSystem.Text = info.Problem
player.PlayerGui.PatientCard.Frame.PatientName.Text = player.Name
player.PlayerGui.PatientCard.Frame.CardSent.Text = sender.Name
player.PlayerGui.PatientCard.Enabled = true
end
end)
And this is how the server would handle that:
local function filter(problem, player) -- you MUST filter the problem text because the player is sending text to somebody else
return problem -- TODO: Filter this text
end
RS.PlayerCardSubmited.OnServerEvent:Connect(function(player, info)
if type(info) ~= "table" then return player:Kick("Invalid remote data.") end
if info.Problem and info.Reciever then
info.Problem = tostring(info.Problem)
info.Reciever = tostring(info.Reciever)
local other = game.Players:FindFirstChild(info.Reciever)
if other then
RS.PlayerCardSubmited:FireClient(other, filter(tostring(info.Problem)), player)
end
end
end)