Localscripts replicates on AI scripts

Hello developers! So I wanted a way to stop monsters from invading the spawn area. I created a part that blocks out mobs but only lets player through. However, when I destroy this part from the client or turn cancollide off, the monsters always go through the part, just like the player. If you need a video of this happening, just tell me. I’m pretty sure you understand how this works. (Player joins, fires remote to client, client destroys/turns cancollide off.)

Are the AI scripts local scripts?

If they aren’t, are you 100% sure the server doesn’t change that on it’s side?

As I said in the title they are scripts. I have looked on the server, and the part is still there but the mob passes through.

Yes, just making sure since people sometimes don’t differentiate between them.

Do the mobs pass through the part on the server as well? Is the server the NetworkOwner of them? Or is it the player?

The server is the network owner. The server replicates all of this, as said in title. :slight_smile:

Yes. I am aware of what the title states, however many people are saying one thing yet mean another thing. Easier to help when making sure what people actually need help with.

I, just as you, see no reason for the server to allow the mobs to pass through said barrier. I am simply listing plausible explanations.

Yep. But that still doesn’t explain to me what is going on. You only verified my factors that I have already stated.

I really don’t understand at all what is happening. Even if the ai scripts are local scripts (which they aren’t) it still should not be going through the part because its on the client.

I think they might’ve, since local scripts factor in the local player’s world. However, that does not matter since it is not the issue at hand.

I am aware you stated that the server is the network owner. But as this is my last suggestion to what the issue may be I’ll just make sure once again.

When a Roblox game runs, several computers/devices are involved. To divide the work of calculating physics, Roblox automatically assigns parts to either the server or to a client. In general, if a part is near an in-game character, its physics will be calculated by that player’s device; otherwise it will be calculated by the server.
Source: Network Ownership (roblox.com)

As this article states, Roblox automatically distributes the work. I don’t know if this would cause that issue, but as I stated it’s my last explanation.

Best of luck.

1 Like

Should I set the network ownership to the player or server then?

On the server. I am not sure whether this actually is the cause, but if I understand/guess correctly:
When the player is the network owner the scripts gets carried out as if that client’s world is law.

However, what is your goal of this system? You can, if you want only players to walk through it, use the PhysicsService (roblox.com) to prevent your mobs from walking through but allow your players. Not sure if that is a better solution though.

1 Like