In Roblox, scripts run on the server or the client. To enable them to communicate with each other, you use RemoteEvents. This way, for example, you can send actions from the player (client) to the server and vice versa.
Here's how:
With RemoteEvents, you can communicate safely and easily between client and server – perfect for advanced scripting!
-- Script im ServerScriptService
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RemoteEvent = ReplicatedStorage:WaitForChild("MeinEvent")
RemoteEvent.OnServerEvent:Connect(function(player, nachricht)
print(player.Name .. " sagt: " .. nachricht) -- Message from client
RemoteEvent:FireClient(player, "Server hat deine Nachricht erhalten!") -- Reply to client
end)