You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
I’m trying to make players not collide, R6 and R15.
What is the issue? Include screenshots / videos if possible!
I have tried it with different scripts, but it doesn’t work.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have already tried YouTube tutorials and Toolbox models, but they didn’t work.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
This is the script I’m using at the moment:
local Players = game:GetService("Players")
local PhysicsService = game:GetService("PhysicsService")
local GroupName = "Players"
PhysicsService:RegisterCollisionGroup(GroupName)
PhysicsService:CollisionGroupSetCollidable(GroupName, GroupName, false)
local function ChangeGroup(part)
if part:IsA("BasePart") then
part.CollisionGroup = GroupName
end
end
local function HandleCharacterAdded(character)
for _, part in ipairs(character:GetDescendants()) do
ChangeGroup(part)
end
end
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
HandleCharacterAdded(character)
character.ChildAdded:Connect(function(object)
ChangeGroup(object)
end)
end)
end)
Try changing CharacterAdded to CharacterAppearanceLoaded, sometimes using charcter added glitches for me, but appearence loaded seems to fix. So something like this:
local Players = game:GetService("Players")
local PhysicsService = game:GetService("PhysicsService")
local GroupName = "Players"
PhysicsService:RegisterCollisionGroup(GroupName)
PhysicsService:CollisionGroupSetCollidable(GroupName, GroupName, false)
function setCollisions(char: Model)
for _, part in pairs(char:GetDescendants()) do
if part:IsA("BasePart") then
if part.CollisionGroup == GroupName then continue end
part.CollisionGroup = GroupName
end
end
end
Players.PlayerAdded:Connect(function(player)
player.CharacterAppearanceLoaded:Connect(function(char)
setCollisions(char)
end)
end)
end)
CharacterAppearanceLoaded only appears to fire once for me, the first time their avatar is loaded, and not when they respawn, at least when I last tested it which was years ago.
plrs = game:GetService("Players")
ps = game:GetService("PhysicsService") -- Physics service
ps:RegisterCollisionGroup("plrs")
ps:CollisionGroupSetCollidable("plrs","plrs",false)
plrs.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(chr)
repeat wait() until plr.Character.HumanoidRootPart ~= nil
wait(2)
for i, value in pairs(chr:GetChildren()) do
if value:IsA("BasePart") then
value.CollisionGroup = "plrs"
end
end
end)
end)