Cancolliding problem

What I want to achieve is solving this problem, obviously. I have tried a few solutions that I have thought of so far. Anyways, to the point. I have a LocalScript with the parent of StarterGui. Basically, this script disables the CanCollide off so the NPCs around can walk over a specific part while the players in the game can’t. Before the game start, CanCollide is actually enabled, but the script just turns it off so that way the NPC can walk over it without falling through it while the players can’t. The reason why the script is a LocalScript and not a Script is to prevent the NPC from being able to fall through.

There is a problem though, it works until after like 30 seconds or a bit later than that. Meaning, the players and the NPC can fall through it.

Here is the script;

local folder = game.Workspace:WaitForChild("ZombieParts")

for i, part in pairs(folder:GetChildren()) do
	part.CanCollide = false
end```

What my thoughts are going through is that it should work, right?
2 Likes

Can we get an image/screenshot of your workspace and an explanation as to why you need to set cancollide to false?

1 Like

The explanation should be in the topic post.

I have a LocalScript with the parent of StarterGui . Basically, this script disables the CanCollide off so the NPCs around my map can walk over it while the players in the game can’t. Before the game start, CanCollide is actually enabled, but the script just turns it off so that way the NPC can walk over it without falling through it while the players can’t. The reason why the script is a LocalScript and not a Script is to prevent the NPC from being able to fall through.

This is the folder of all the parts.
image

1 Like

What do you mean by walking over the map? Is there a specific part, or am I missing something?

Specific Part. I want the NPC to be able to walk over a specific part, but not any players.

1 Like

Using this method sounds like a pretty hacky solution, this also heavily depends if the NPC’s are being updated locally or server sided.

Try using collision groups instead:

3 Likes

The NPC’s are being updated server sided. I appreciate it.

Collision groups will work server sided, I would say that is your solution :+1:

2 Likes

It won’t matter how you are updating them, collision filtering is exactly what you need. If done correctly you will have it where the players can collide with it whilst the NPCs cannot.

1 Like

Alrighty, I will start working on this, appreciate it.

1 Like