I am currently making a game where the NPC is protecting a weapon inside of a box and the player needs to get it, meaning the player can collide with the box and the NPC can not. How can I do that? I tried adding CollisionGroups but I am really confused on how it works. Does anyone have more info or other ways I can do it? Thank you!
In the plugin: in the plugin bar these buttons will appear, press “Add Collision Group” and type a word in the box that will appear and press enter.
What does the game know that it is a group for players? The game does not know, so you must make a script for that, here something simple.
for _,Part in pairs(script.Parent:GetDescendants()) do
if not Part:IsA("BasePart") then continue end
game:GetService("PhysicsService"):SetPartCollisionGroup(Part, "Players")
end
Put it in a Server Script and put it in StarterCharacterScripts.