local PhysicsService = game:GetService('PhysicsService') local Players = game:GetService('Players') PhysicsService:CreateCollisionGroup('Players') PhysicsService:CreateCollisionGroup('NPCs') PhysicsService:CollisionGroupSetCollidable('Players', 'NPCs', false) local NPC = game.ReplicatedStorage.EventEnemies.Mini local function SetModelGroup(Model, Group) for _, Part in ipairs(Model:GetChildren()) do if (Part:IsA 'BasePart') then PhysicsService:SetPartCollisionGroup(Part, Group) end end end local function OnClientAdded(Client) local function OnCharacterLoaded(Character) SetModelGroup(Character, 'Players') end Client.CharacterAppearanceLoaded:Connect(OnCharacterLoaded) end SetModelGroup(NPC, 'NPCs') Players.PlayerAdded:Connect(OnClientAdded)
This script makes a NPC non collide able, but theres more than one model, I tried to create multiple scripts for each mode, but it didn't work. I tried multiple ways to make more than one NPC model work inside of a script but none of them worked. Is there a way to make multiple models work with this script? hopefully that made sense
do you mean models inside of other models? you can replace GetChildren()
with GetDescendants()
also, perhaps you want to organize this with TagService
. I won’t explain it here but you can us it to pretty much gather everything marked with a certain label and use the same script on them, instead of doing this for every single NPC.