I made a player carrying system and it works well except for one thing the character carrying the carried player collides with the character and it just goes crazy.
I have tried everything nothing seems wrong but for some reason it won’t work.
maid[player.Name.."CarryPrompt"] = CarryPrompt.Triggered:Connect(function(playerWhoTriggered)
local PlayerWhoTriggeredCharacter = playerWhoTriggered.Character
local PlayerWhoTriggeredHumanoidRootPart = PlayerWhoTriggeredCharacter:WaitForChild("HumanoidRootPart", 10)
if IsCarrying.Value == false then
IsCarrying.Value = true
RevivePrompt.Enabled = false
CarryPrompt.ActionText = "Uncarry "..player.Name
for _, v in pairs(Players:GetPlayers()) do
if v.Name ~= playerWhoTriggered.Name then
CarryEvent:FireClient(v, CarryPrompt)
end
end
for _, v in pairs(character:GetChildren()) do
if v:IsA("BasePart") then
v.Massless = true
v.CollisionGroup = "NoCollision"
end
end
local CarryAttachment0 = PlayerWhoTriggeredHumanoidRootPart:WaitForChild("RootAttachment", 10):Clone()
CarryAttachment0.Name = "CarryAttachment0"
CarryAttachment0.Position = Vector3.new(0, 0, 0.5)
CarryAttachment0.Parent = PlayerWhoTriggeredHumanoidRootPart
local CarryPosition = Instance.new("AlignPosition")
CarryPosition.Name = "CarryPosition"
CarryPosition.Mode = Enum.PositionAlignmentMode.TwoAttachment
CarryPosition.ApplyAtCenterOfMass = false
CarryPosition.Attachment0 = RootAttachment
CarryPosition.Attachment1 = CarryAttachment0
CarryPosition.MaxForce = math.huge
CarryPosition.Responsiveness = 200
CarryPosition.Parent = humanoidRootPart
else
--This isn't done yet
end
end)
local PhysicsService = game:GetService("PhysicsService")
PhysicsService:RegisterCollisionGroup("PlayerCollisons")
PhysicsService:CollisionGroupSetCollidable("PlayerCollisons", "PlayerCollisons", false)
local function disableCollisions(character)
for _, bodyPart in pairs(character:GetChildren()) do
if bodyPart:IsA("BasePart") then
bodyPart.CollisionGroup = "PlayerCollisons"
end
end
end
local function enableCollisions(character: Model)
for _, bodyPart: BasePart in pairs(character:GetChildren()) do
if bodyPart:IsA("BasePart") then
bodyPart.CollisionGroup = "Default"
end
end
end
That’s interesting, try setting the network ownership of the Target to the Player and when you’re finished carrying with them set it back to the server (nil)
local function disableCollisions(character)
for _, bodyPart in pairs(character:GetDescendants()) do
if bodyPart:IsA("BasePart") then
bodyPart.CollisionGroup = "PlayerCollisons"
bodyPart:SetNetworkOwner(player)
end
end
end
local function enableCollisions(character: Model)
for _, bodyPart in pairs(character:GetDescendants()) do
if bodyPart:IsA("BasePart") then
bodyPart.CollisionGroup = "Default"
bodyPart:SetNetworkOwner(nil)
end
end
end
The AlignPosition was lagging behind so I had to create a heartbeat to constantly set the network ownership of the carried players BodyParts to the player carrying them so it doesn’t lag, but it works great.
(I made sure to handle the collisions before handling the player being carried)