I'm making a group of walls that are only supposed to allow players in by putting all their parts into a collision group. It works, but it often glitches and doesn't allow my player to walk through at all. Here's my current script, it's a server script put into a model.
local boundries = script.Parent.Boundries local Field = script.Parent.Field physics = game:GetService("PhysicsService") players = game:GetService("Players") local plrs = "Players" physics:CreateCollisionGroup(plrs) local wls = "boundries" physics:CreateCollisionGroup(wls) physics:CollisionGroupSetCollidable(wls, plrs, false) physics:SetPartCollisionGroup(boundries.A, wls) physics:SetPartCollisionGroup(boundries.B, wls) physics:SetPartCollisionGroup(boundries.C, wls) physics:SetPartCollisionGroup(boundries.D, wls) players.PlayerAdded:connect(function(Player) Player.CharacterAdded:connect(function(Character) for i, child in pairs(Character:GetChildren()) do if child:IsA("BasePart") then physics:SetPartCollisionGroup(child, plrs) print(child.Name.." was added to '"..plrs.."'") physics:CollisionGroupSetCollidable(wls, plrs, false) end end end) end)
Does anyone know what I'm doing wrong, or is this just a stupid glitch? Thanks.