Im planning on making a game that revolves around darkness using fog. The game could be completely ruined if someone where to use a very simple hack to disable the fog, and I want to prevent that from happening. I will be constantly checking the graphics quality to make sure that it is high enough for fog to render and not let the player play if not, as well as checking if the fog is enabled (and if not, fire a remote event to kick the player). However, I’m worried that hackers will just be able to disable these scripts or delete them, etc. Does anyone have a safe way to go about this? I know it can’t be perfect but I want it to deter most hackers.
As some people here said, you can absolutely not 100% keep a LocalScript alive. A method might be to make the server ping the LocalScript every 10 seconds or so. Another one/on top of that to make another LocalScript ping the script every RunService.Heartbeat. Another one/on top of that parent the LocalScript(s) to nil. “nil” does not really delete scripts, it just makes them not be parented to anything (if you understand that). So your scripts would still be running but not that visible like they were in another service.
EDIT:
To bypass this method, exploits need to:
Kill both LocalScripts at the same time
(Freeze game physics so RunService.Heartbeat does not fire in process)
Script a replacement that answers to the servers ping
So that might be a step into the right direction.
You also shouldn’t rely on the server pinging the client because network timeouts, lag spikes, etc.
Exploiters never have access to the source, only compiled and stripped bytecode (which has no notion of formatting, because it is bytecode). Doing this would be pointless.
Ive found another problem though
How can I safely check if there should be fog? In my game, the fog should be removed in certain circumstances, and how can I know for sure that its actually supposed to be removed?
in any case, it allows you to bypass the check.
When the lights come on, it replicates. maybe the check will check if they are turned on. but even that can be bypassed.
I wouldn’t use the remote event.