#1. The FilteringEnabled
Turning FilteringEnabled on makes the LocalScripts with no capabilities of "touching" the server. Since exploiters use to hack their own client, injecting LocalScripts on it, any changes performed on it (for example, create a part) won't affect the server at all.
#2. The communication client-server
To solve this problem, ROBLOX introduced those special channels called RemoteEvents and RemoteFunctions. Translated to English, using those channels would like be:
Client: Hey server, can you run the function connected to this Remote, please?
Server: Sure!
#3. How to establish connection between those scripts.
Let's imagine we have a GUI button, and we want to make it change the color of the baseplate.
So we could use a LocalScript inside of the button:
script.Parent.MouseButton1Click:connect(function()
game.Workspace.Baseplate.BrickColor = BrickColor.Random()
end)
This would work, right? With FilteringEnabled set to true, no. The maximum that could happen is that ONLY you could see the changes. Since LocalScripts can't replicate, the server does not see those changes.
So what to do?
We could use a RemoteEvent so that the LocalScript can ask the server to run a function (defined on a Script) - since the server will perform the actual change, it will be visible to everyone on the server.
1st we need to create the RemoteEvent - this should be visible to BOTH server AND client - the Workspace is visible to both, so they can communicate through there.
So let's assume there is a RemoteEvent called RE on the Workspace
script.Parent.MouseButton1Click:connect(function()
game.Workspace.RE:FireServer()
end)
local remote = game.Workspace.RE
remote.OnServerEvent:connect(function()
game.Workspace.Baseplate.BrickColor = BrickColor.Random()
end)
Now, the problem of the FileteringEnabled is solved!
NOTE: Server Scripts don't run very well on the ReplicatedStorage, or do not run at all.
NOTE 2: If you have any dobut, check out this documentation. It will help you:
The complete tutorial here
RemoteEvent API
RemoteFunction API
If this helped, be sure to accept it! Thank you!
1 comment
The explaining, i give 10/10 i will save this so i can check it out when i have problems. THANKSSSSSSS