I’m currently trying to make it so that players walk through the Ais. I was also able to make it so the Ai can walk through each other, which works. For some reason, I’m having difficulty with the Player to Ai. I feel like there is a really easy way of doing this.
script.Parent = game:GetService("ServerScriptService")
local PhysService = game:GetService("PhysicsService")
local PlayerGroup = PhysService:CreateCollisionGroup("g")
local AiBaseA = PhysService:CreateCollisionGroup("a")
function NoCollideAi(plychar)
game.Workspace.Bases.BaseA.NewPassangers.ChildAdded:Connect(function(aichar)
for i,v in pairs(aichar:GetChildren()) do
if v:IsA("BasePart") then
PhysService:SetPartCollisionGroup(v, "a")
for e,c in pairs(plychar:GetChildren()) do
if c:IsA"BasePart" then
PhysService:SetPartCollisionGroup(c,"g")
PhysService:CollisionGroupSetCollidable("g", "a", false)
end
end
end
end
end)
end
game:GetService("Players").PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(plychar)
plychar:WaitForChild("HumanoidRootPart")
NoCollideAi(plychar)
end)
end)```