Non Collidable blocks for Ai(Server) and Collidable blocks for Player(Client)

Hello, i have an Pathfinding ai that gets stuck on objects alot so i made a folder with the blocks the ai gets stuck on, then made it all with CanCollide off, i put a script in the StarterPlayerScripts in the player that makes everything in the folder Collideable, this worked on my old world but i made a new one and it no longer works, is there another way to do this or fix the script?

for _, child in ipairs(game.Workspace["Part 1"].BlockList:GetChildren()) do
	if child:IsA("Part") then
		child.CanCollide = true
	end
end

instead of Child.Collide i did print(Child.name) and it gets everything in the folder but wont work.

1 Like

have you considered using CollisionGroups?

i tried alot back then but never could get it to work

1 Like

From what I am assuming Collision Groups don’t work well with Ai?

yeah so thats why i came up with this but idk why it wont work with my new world

1 Like

It’s just I feel that it would simply be easier to set the blacklist to a CollisionGroup that allows the ai to go threw but then have a localscript that sets the player to a preexisting CollisionGroup that does the opposite.

have you tried running this script in a localscript?

Yeah that’s what it’s orginally in

1 Like
for _, child in ipairs(game.Workspace["Part 1"].BlockList:GetChildren()) do
	if child:IsA("BasePart") then
		child.CanCollide = true
	end
end

Check if the child is a BasePart instead?

I don’t think it’ll work, the original world had the script where it Dident check if it was a block or anything and it worked fine but I changed it to check if it was a part in the new worked or see if it would work and it doesn’t

1 Like

I could video it and send u if u want

1 Like

But it should, parts are called “baseparts”

Edit: A video would help

Alright I’ll send it in 5 minutes

1 Like

Videos a little zoomed in but as u see on server side it’s collide off but when I join the game I’m able to collide with it, the script works fine but won’t in the other game no idea why

1 Like

I have tried the code provided and it does work, I’m not sure what to really say about this.

Nvm the video won’t send its to long but idk what to do

1 Like

Could you atleast try the code I modified? I’m pretty sure it does the trick.

Still doesn’t work I don’t know what’s wrong with this world

1 Like

May I take a look at the item tree of the folder? perhaps there might be something wrong with that.

Place3.rbxl (45.9 KB)
I don’t really understand the issue, I have tried the code and it does work.