How can I check if a Value is changed by a client script?

I want to prevent exploiters from changing values, and when the value is changed, I want to print out if a script or local script changed it.

How can I check if a Value is changed by a client script?

1 Like

In a local script, listen for changes on the value, then FireServer(clientAmount) to a remote event in the script that handles that remote event (make sure to take in the clientAmount parameter), check if the value is == the clientAmount

It can’t be changed by a client script as part of exploit prevention. If the client tries to change it, either with a LocalScript or an exploit, neither the servers nor any other players will be able to see the changes.
Any changes to this value will need to be routed through the server with RemoteEvents.

The server needs to keep track of what this value is supposed to be so that if the player tries to change it (with a RemoteEvent) drastically and all of a sudden the server can disregard the changes.

1 Like

Can’t the player just disable the local script??

Yes, any exploiters can just disable the local script that is checking whether a value has changed or not. As @JarodOfOrbiter stated, you will need to use remote events to be able to change the values. Any values you change in the client, will not replicated to other players or the server.

Let’s say, for arguments sake, every 30 seconds you want to check something.

You could use a RemoteEvent to fire the client every thirty seconds, if the Value is different on the client to the server, you can simply set it to whatever the server has it set as. (Something such as <RemoteEvent>:FireAllClients(30)).

Obviously, an exploiter can simply disable this script that handles the <RemoveEvent>.OnClientEvent side of things, so I’d just suggest keeping all data in remotes only handled & read by the server, ignore any of the values the client gives.

Should I just check so if the script is disabled, enable it again?

1 Like

This is impossible. Anything on the client can be deleted from the client or anything that the server listens from the client can be manipulated. Also, if an exploiter changed a value it wouldn’t replicate to the server either.

It gets disabled from the client, so there’s just no way to make a client anti-cheat. I tried many times, and there’s no way.

you could do this in local script

valuedirectory:GetPropertyChangedSignal("Value"):Connect(function()
	event:FireServer()
end)

and than in script that checks it u could have it

event.OnServerEvent:Connect(function(player)
	print(player.. "Client Has Changed Value")
end)
valuedirectory:GetPropertyChangedSignal("Value"):Connect(function()
	print("Server Changed The Value")
end)
2 Likes

Listen for changes in another client script.

Did you know exploiters can edit, disable, and delete local scripts?

Isn’t it only replicated for the client though?

1 Like

Yes but local scripts are ran from the client… which means it can be disabled from the client which will stop all things running in that script because it’s running from the client

u could have a script in server script service that checks to is script there or disabled

1 Like

Bro, the client disables the script from their client. No server replication there.

well idk what to do there than the most effective thing than is to have the local script constantly enable it and than have other local script constantly enablind the other one

1 Like

Selecting both scripts then deleting them is possible yk. Or even if you constantly cloned a local script from the server, they could hook up a while loop to that and destroy it before it even runs. Even if you did multiple local scripts, it wouldn’t work plus it’d cause so much lag

than idk how else would u prevent exploiter from doing anything else other than having antiexploit that actualy detects if it was injected

As aforementioned, everything on the client can be manipulated.
If your solution to exploiters involves ANY LocalScript usage then forget it. Although it may work, once bypassed, you’ll be in a cat and mouse chase against exploiters which you will lose.

Realistically, you shouldn’t care if a value is changed by an exploiter, because you shouldn’t make a game changing impact happen from a client value.

1 Like