How to make players non collidable with eachother?

I have honestly tried everything. I have found this topic so many times on the devforum and tried every single solution which is pretty much the same but I can’t seem to be able to make players phase through each other

Here’s my current code in a server script which for some reason doesn’t work:

function NoCollide(char)
	for _,v in pairs (char:GetChildren()) do
		if v:IsA("BasePart") then
			v.CollisionGroup = "NonCollidablePlayers"
		end
	end
end

function Collide(char)
	for _,v in pairs (char:GetChildren()) do
		if v:IsA("BasePart") then
			v.CollisionGroup = "Default"
		end
	end
end

I’ve tried setting the Collision group’s collidable settings both by the Model menu and manually via code but nothing works. The timing of when the functions fire is correct it just doesn’t work for some reason. If you can find any errors with this or something I’m doing wrong I’d appreciate your help.

1 Like

Change get children to get descendants.

Also I use this script it works just fine and its shorter

local players = game.Players
players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		repeat 
			wait()
		until plr.CharacterAppearanceLoaded
		local chardescendants = char:GetDescendants()
		for _, descendant in ipairs(chardescendants) do
			if descendant:IsA("BasePart") then
				descendant.CollisionGroup = "Player"
			end
		end
	end)
end)

Nvm figured it out thank for your time tho

Mark a reply as solution to close the thread.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.