How to make a functioning Carry script?

I’ve tried numerous ways and I usually end up having desync issues because of NetworkOwnership between the 2 players. Any recommendations to not have desync or any methods to work around this? All I want is to be able for one player to hold the other

1 Like

explain what you actually mean by this lol

1 Like

What methods have you tried to carry players. Have you ever thought about welding? I did that once for a project and it seemed to work perfectly fine, no NetworkOwnership needed.

Weld
WeldConstraint

1 Like

Set carried players network owner to the player who carries him only for the duration of the carrying, also use a motor6d and destory it if either players health drops below 1

2 Likes

For example one player clicks a keybind on their keyboard and it plays a carrying animation and the person being carried is in that players hands. Ussually a weld constraint is needed I am currently using motor6d and have tried transferring NetworkOwnership among the 2 players and its still causing slight desync

If the desync is in the animation try loading and playing it on the server, besides that make sure all descendant parts network owner is set, accessories, body parts etc

Giving it a try right now, will update you.

Still having desync even after attempting to set carried players network owner to the player who carries him temporarily. I can send the main parts where I am doing that if you would like to see for yourself.

Heres another idea, try turning on massless for all base parts from the carried character, if that doesnt work i can send you a module i made to solve this for my game tomorrow

1 Like

I would honestly appreciate that, considering me even making base parts massless is still having a cause of desync.

Sorry for the delay, I kinda forgot, and even tho you already set the solution heres the module I use

local character = script.Parent.Parent
local Humanoid = character:WaitForChild("Humanoid")
local player = game.Players:GetPlayerFromCharacter(character)

local value_index = {
	IsSitMass = {Parent = Humanoid,ActivationValue = true}	
}

local BodyParts = {
	"Head",
	"HumanoidRootPart",
	"Left Arm",
	"Left Leg",
	"Right Arm",
	"Right Leg",
	"Torso",
}

function CheckActivacion(Value:boolean,TargetName)
	local NetworkOwner = player
	
	if TargetName then
		NetworkOwner = game.Players:FindFirstChild(TargetName) or player
	end
	
	for _,part in pairs(character:GetChildren()) do
		if table.find(BodyParts,part.Name) and part:IsA("BasePart") then	
			if Value == true then
				local succ,fail = pcall(function()
					part:SetAttribute("OgMass",part.Massless)
					part.Massless = true

					part:SetNetworkOwner(NetworkOwner)
				end)
			else
				local succ,fail = pcall(function()
					part.Massless = part:GetAttribute("OgMass") or false
					part:SetAttribute("OgMass",nil)

					part:SetNetworkOwner(player)
				end)
			end
		end
	end
end

local module = {
	Check = function(PlayerName)
		local Activate = false
		
		for Name,Datatable in pairs(value_index) do
			if Datatable.Parent:GetAttribute(Name) == Datatable.ActivationValue then
				Activate = true
				break
			end
		end
		
		CheckActivacion(Activate,PlayerName)
	end,
}

return module

The module itself is in a folder called ragdoll inside startercharacterscripts, heres how I activate it

local RGFolder = Character and Character:FindFirstChild("Ragdoll")
local MassHandler = RGFolder and RGFolder:FindFirstChild("CharacterMass")

if MassHandler then
	MassHandler = require(MassHandler)
end

Character:SetAttribute("IsSitMass",true)
MassHandler.Check(Player.Name)

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