How do I make a player Carrying player system?

So. I want to make it so that when a certain keycode (v) is pressed, it picks up the nearest ko’d player.

The Issue is that i honestly dont know how this system works, I understand keycode, and player distance and everything, but I dont get the part that you actually pick up the player.

So far, I have made the keycode, finding the nearest player, and a knockout system. When a player (or NPC) is knocked out, it creates a bool value inside the humanoid called ‘ko’, that you can detect with a script. I use :FindFirstChild() to detect this.

Please give me feedback how i could make a carrying system.

5 Likes

I’ve actually added this in my game!

First, we will have to get the player (i know you already made that but my carry script works with a function)

	local function getplr()
		local magn = 4.5
		for _, guy in pairs(workspace:GetChildren()) do
			if guy == nil then return end
			if guy:FindFirstChild("Humanoid") and guy:FindFirstChild("HumanoidRootPart") and guy ~= Player.Character and magn > (guy:FindFirstChild("HumanoidRootPart").Position - Player.Character.HumanoidRootPart.Position).magnitude and guy:FindFirstChild("HumanoidRootPart"):FindFirstChild("alabo") == nil then do
					if guy:FindFirstChild("Humanoid").Health == 0 then return end
					local humz = guy:FindFirstChild("Humanoid")
					local horp = guy:FindFirstChild("HumanoidRootPart")
				end
				return guy
			end			
		end
	end

Then, we will have to weld the players.

	local function weldPlayers(origin,carry)
		local ro, rc=origin.HumanoidRootPart,carry.HumanoidRootPart
		carry.Humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
		carry.Humanoid.PlatformStand = true
		local w=Instance.new("Motor6D")
		w.Name = "carryweld"
		w.Part0 = ro
		w.Part1 = rc
		w.C1 = CFrame.new(-2, 0, 0)
		w.C0 = CFrame.new()
		w.Parent = rc
		for _,v in pairs(carry:GetChildren()) do
			if v:IsA("BasePart") then
				v.Massless = true
			end
		end
	end

We will also need a fuction so you can drop them.

	local function restorePlayer(plr)
		plr.Humanoid.PlatformStand = false
		plr.HumanoidRootPart.carryweld:Destroy()
		for _, v in pairs(plr:GetChildren()) do
			if v:IsA("BasePart") then
				v.CollisionGroupId = 0
				v.Massless = false
			end
		end
	end

Now I think you know how to make it up together and make it work. How I did it was I made a variable called “Carry” and set it to false and when you press v it turns to true and it runs the function weldPlayers(player.Character, carried), I got the carried variable by doing local carried = getplr(), then if you press v again it turns “Carry” to false and runs the function restorePlayer(carried). (Its all done in a server script)

Good luck and let me know if there are any errors!

(Also, you will need to put an animation to play for both your player and the character)

21 Likes

I actually have made a carry player system (without any help :C) but there is a problem with that script, when you pick up the player, you cant rotate your character, is this a problem when welding, or am I doing something wrong?

and I don’t know how to do this, is it possible if you could tell me?

To add animation you just have to make a variable for example:

local anim = player.Character.Humanoid:LoadAnimation(script.Anim) -- you can replace script.Anim with where your animation is located

Now, you will need to make two, one for the player carrying and the other for the player getting carried.

Then you just do anim:Play() in the keycode script that you already have made.

And I’m not sure what you mean about unable to rotate your character. It might be because you are colliding with him so make sure to add a collision group. You could send a gif of what happens when you attempt to rotate or send your discord so you can send it in my dms.

the problem with this is that playing an animation for a different player doesnt replicate to the server, only YOUR client does

Send me your discord user and tag.

I’ve tried your script, there’s some bug with the script. Whenever the carried player died, the player also died too

2 Likes