How to check if an instance is "local only"?

Is there a way to check if an instance is only localised and not server replicated?
I want to do this without using RemoteEvents, RemoteFunctions, etc.

Not sure if this is the best solution, but you could tag objects you create on the client (using CollectionService).

As Darkmist101 said, CollectionService is your only choice here. The simplest way to do this would be using RemoteFunctions, but since you don’t want them, you’ll have to tag every locally created object.

The server isn’t even aware of the objects you created locally, while the client sees them just as an object that doesn’t receive any physics updates from the server.

I’m going to use this for an Anti-Exploit.
The problem with using CollectionService is that I can’t tag all local instances because an exploiter can just make an instance that isn’t going to be tagged therefore, bypassing my system.

This sounds somewhat like an XY problem. Can you give us an idea of what you are trying to achieve? You mentioned this will be used to combat exploiting, however from what I can see that will be redundant.

Cheers.

2 Likes

The way I did this on an old project I abandoned was to divide the workspace into multiple folders. Static objects that never get changed at all, static objects that don’t change their ancestry or receive any descendants and dynamic objects whose properties are strictly controlled.

Kick the player if something is added to the objects with static ancestry after the game is loaded.
Kick the player if .Changed is fired at all in the fully static objects.
Kick the player if a property is changed that should never change.

This might look like it will cause a lot of lag, but it really doesn’t as most connections don’t even get fired, or they just check if the property is a restricted one.

You can’t check whether an instance exists on the server or the client because that’s not how instance replication works. The least you can do is try to index the object and see whether or not it returns nil or an error, but that’s an absolutely horrid workaround.

I’m almost certain what you’re trying to do does not involve the need to check an instance’s replication state. What’s your real problem?

2 Likes

Can’t you just send a RemoteFunction with the object in question as an argument and check if it’s nil on the server?

So I have this Server Script that will clone a Local Script, every second to every player, to check for any BodyMovers that isn’t server replicated.

image

The idea is that if the Local Script detects a localised BodyMover, the player will be kicked from the game. As soon as checking finishes, the script will be destroyed so that it stops the issue with exploiters modifying/deleting/disabling Local Scripts. A new fresh copy of the script will be cloned/destroyed and repeat the checks.

game.Players.LocalPlayer.Character.ChildAdded:Connect(function(Child)
	if Child.Name == "Local" then
		Child:Destroy()
	end
end)

I have tried this code to mimic an exploiter trying to delete the Local Script as soon as it is parented to the client. This doesn’t stop the checks so you don’t need to worry about the issue with using Local Scripts as anti-exploits.

This sounds like a bad idea. You should try implementing server-sided checks instead of clientsided ones whenever possible.

There is a ton of things an exploiter can do to get around your check:

  • Spoof ClassName of body movers
  • Spoof IsA()
  • Cut access to any roblox instance metamethods for specific localscripts (i.e. ones named Local but not limited to)
  • Set Disabled of any newly ran LocalScripts
  • Hook the player:Kick() function

of course it is possible for you to get around those methods, but it’s fairly pointless, as it’s a cat & mouse game, so you’re better off making a server-sided check.

Yes you could, that’s essentially what my workaround suggested. The thing is that OP doesn’t want to use remotes (for whatever reason, perhaps underestimating how much a remote can take?).

1 Like

How would I reliably server check for a player that is flying?

Also, I wasn’t aware that exploiter could do this:

Thank you for informing me, I will now use Server Scripts instead.

I didn’t want to use Remotes because there is a delay depending on the client’s connection. I wanted it to be instantaneous and quick.

2 Likes

Don’t see a problem in a small delay. Just spawn the call into a new thread to avoid the code waiting for a response.