I Been Making A System That Get Code From Server. And Excute On All Clients. Example: Create Button And Click It On Client Appeer A Text On Server. But Others Couldn’t See It. I Have Tried:
Uh. So. How Do I Excute From Server To Client In Plain?:
Like When Reiceve. It Send The Data To All Clients To Create The Text(For Performance Ig) In Plain Code?
As others have said, remote events are the way. Basically, you can fire the server from the client and send information. Just remember to always double check important data on the server, like how many coins to add.
then make script in server script service
code 01 game.ReplicatedStorage.event.OnServerEvent:Connect(function(player,text) Instance.new("Hint",workspace).Text = tostring(player).. "sent"..text end)
next use local script to send the text and the player who activated it
code 02 local text = "evil" script.Parent.TextButton.MouseButton1Up:Connect(function() game.ReplicatedStorage.event:FireServer(text) end)
For client → server communication we often use remote events. Remote events are basically “doors” you open to the server, allowing the client to pass information through. However this information isn’t 100% trustworthy, it can be coming by an exploiter trying to gain an unfair advantage(just like a thief trying to break into your house). Therefore when you open such doors you need to always validate the data the client passes through on the server, basically check if the data is valid given your game/scripts behavior and ensure the client asking for something actually has the permission to do it.
The way we check is by taking advantage of the first default argument the server picks up, the player argument, that indicates which client fired the remote. This is the only piece of information we actually trust to make the checks.
if you have the data on the server side, you can use it on the server then use :FireAllClients() or :FireClient (if you only need a specified player)
However, if the data is located on the client then you can send it to the server so that it processes the data then fires to all clients (if you want all the clients to use the data)
in all cases you should use a remote event for transporting data between server and client