Problem with collision groups

Hi so I’ve been stuck on this problem for hours and everything i’ve tried so far didn’t work
*Changed the collision group name
*chaged the networkownership
*tried creating the col. groups via. script

I have no clue pls. help
ServerScriptService:

----------------------------------/varibles/
local dolltemplate = game.ServerStorage.Serverasstes.dollpreset
--------------------------------------------/functions/
function createnewdoll(player)
	local playerdoll = dolltemplate:Clone()
	playerdoll.Parent = workspace.dolls
	for i , part in ipairs(playerdoll:GetDescendants()) do
		if part:IsA("MeshPart") then
			part.CollisionGroup = "Dolls"
		end
	end

	playerdoll.Head:SetNetworkOwner(player)
	return playerdoll
end
--------------------------------------------/classes/
-----

--------------------------------------------/Setupddollfunc/
game.ReplicatedStorage.setupdoll.OnServerInvoke = function(player)
	if workspace.dolls:FindFirstChild(player.Name) then
		workspace.dolls:FindFirstChild(player.Name):Destroy()
	end
	for i , bodypart in ipairs(game.Players:FindFirstChild(player.Name).Character:GetChildren()) do
		if bodypart:IsA("Part") then
			bodypart.CollisionGroup = "Players"
			bodypart.Transparency = 1
			if bodypart:FindFirstChildOfClass("Decal") then
				bodypart:FindFirstChildOfClass("Decal"):Destroy()
			end
		end
		if bodypart:IsA("Accessory") then
			bodypart:Destroy()
		end
	end
	local playerdoll = createnewdoll(player)
end

Client script under starter char.:

local lp = game.Players.LocalPlayer
local char = lp.Character
local dolls = workspace.dolls
local doll 
---------------------------------------/initialize/
while doll == nil do
	game.ReplicatedStorage.setupdoll:InvokeServer()
	doll = workspace.dolls:FindFirstChild(lp.Name)
end
for i , part in ipairs(doll:GetDescendants()) do
	if part:IsA("MeshPart") then
		part.CollisionGroup = "Dolls"
		end
end
for i , bodypart in ipairs(char:GetChildren()) do
	if bodypart:IsA("Part") then
		bodypart.CollisionGroup = "Players"
	end
end

end)

It keeps bugging out and the character colides with the other character

5 Likes

Can you send a screenshot of the playerdoll?

1 Like

Screenshot 2023-11-19 213452

1 Like


1 Like

Do the ragdolls work? Because if they do I believe I have a solution.

1 Like

client

local lp = game.Players.LocalPlayer
local char = lp.Character
local dolls = workspace.dolls
local doll 
---------------------------------------/initialize/
while doll == nil do
	game.ReplicatedStorage.setupdoll:InvokeServer()
	doll = workspace.dolls:FindFirstChild(lp.Name)
end
for i , part in ipairs(doll:GetDescendants()) do
	if part:IsA("MeshPart") then
		part.CollisionGroup = "Dolls"
		local alignpos = Instance.new("AlignPosition")
		alignpos.Parent = part
		alignpos.Name = part.Name.."muscle"
		alignpos.Mode = Enum.PositionAlignmentMode.OneAttachment
		alignpos.Attachment0 = part:FindFirstChildOfClass("Attachment")
		alignpos.RigidityEnabled = true
		alignpos.ApplyAtCenterOfMass = true
		alignpos.Position = char:FindFirstChild(part.Name).CFrame.Position
		char:FindFirstChild(part.Name).Changed:Connect(function(value)			
		end)
	end
end
for i , bodypart in ipairs(char:GetChildren()) do
	if bodypart:IsA("Part") then
		bodypart.CollisionGroup = "Players"
	end
end
game:GetService("RunService").PreSimulation:Connect(function()
	for i , constraint in ipairs(doll:GetDescendants()) do
		if constraint:IsA("AlignPosition") then
			local part = constraint.Parent
			if constraint then
				constraint.Position = char:FindFirstChild(part.Name).CFrame.Position
			end
		end
	end
end)

Server

----------------------------------/varibles/
local dolltemplate = game.ServerStorage.Serverasstes.dollpreset
--------------------------------------------/functions/
function createnewdoll(player)
	local playerdoll = dolltemplate:Clone()
	playerdoll.Name = player.Name
	for i , constraint in ipairs(playerdoll:GetDescendants()) do
		if constraint:IsA("Motor6D") then
			local socket = Instance.new("BallSocketConstraint")
			socket.Name = constraint.Name.."-ballsocket"
			local a1 = Instance.new("Attachment")
			local a2 = Instance.new("Attachment")
			a1.Name = "a1"
			a2.Name = "a2"
			a1.Parent = constraint.Part0
			a2.Parent = constraint.Part1
			socket.Parent = constraint.Parent
			socket.Attachment0 = a1
			socket.Attachment1 = a2
			a1.CFrame = constraint.C0
			a2.CFrame = constraint.C1
			constraint.Enabled = false
			if constraint.Name == "Neck" then
				socket.LimitsEnabled = true
				socket.TwistLimitsEnabled = true
			else
				socket.TwistLimitsEnabled = false
				socket.LimitsEnabled = false
			end
			constraint.Part1.CanCollide = true
			constraint:Destroy()
		end
		if constraint:IsA("MeshPart") then
			constraint.CanCollide = false
		end
	end
	playerdoll.Parent = workspace.dolls
	for i , part in ipairs(playerdoll:GetDescendants()) do
		if part:IsA("MeshPart") then
			part.CollisionGroup = "Dolls"
		end
	end

	playerdoll.Head:SetNetworkOwner(player)
	return playerdoll
end
--------------------------------------------/classes/
-----

--------------------------------------------/Setupddollfunc/
game.ReplicatedStorage.setupdoll.OnServerInvoke = function(player)
	if workspace.dolls:FindFirstChild(player.Name) then
		workspace.dolls:FindFirstChild(player.Name):Destroy()
	end
	for i , bodypart in ipairs(game.Players:FindFirstChild(player.Name).Character:GetChildren()) do
		if bodypart:IsA("Part") then
			bodypart.CollisionGroup = "Players"
			bodypart.Transparency = 1
			if bodypart:FindFirstChildOfClass("Decal") then
				bodypart:FindFirstChildOfClass("Decal"):Destroy()
			end
		end
		if bodypart:IsA("Accessory") then
			bodypart:Destroy()
		end
	end
	local playerdoll = createnewdoll(player)
end

1 Like

No but do the ragdolls work or do they not work.

1 Like

It says they all are in their collision groups on the server and on the client

1 Like

Yes they are working mostly -----------------------------

1 Like

1 Like

Try adding this into ServerScriptService

local ps = game:GetService("PhysicsService")

ps:RegisterCollisionGroup("Dolls")
ps:RegisterCollisionGroup("Players")

ps:CollisionGroupSetCollidable("Dolls", "Players", false)
1 Like

still does’t work-------------------------

1 Like
local ps = game:GetService("PhysicsService")

ps:RegisterCollisionGroup("Dolls")
ps:RegisterCollisionGroup("Players")

ps:CollisionGroupSetCollidable("Dolls", "Players", false)

game.Player.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
for _, part in pairs(char:GetChildren()) do
if part:IsA("BasePart") then
part.CollisionGroup = "Players"
end
end
end)
end)

ignore terrible formatting, im on mobile

1 Like

It already sets the colision group of the player when respawning because its done while the setup of the ragdoll which runs when the player spawns (I even checked it)

1 Like

Did you check via server or client?

1 Like

booth --------------------------------------------------

1 Like

maybe its an engine bug ---------------------------

1 Like

I’d have to check on PC since I’m currently on mobile, I’m unable to help you

1 Like

ok I have time ----------------------------------

1 Like

Also I’m about to head to sleep + personal issues in the morning, so you’d have to wait a long time or for someone else, sorry.

1 Like