Need help with making a character that is controlled by two players

Hello!
I want to create a character that is controlled by two players. One player controls walking and another player controls jumping. The problem with my code is that i cant seem to get it to work properly. The player that is supposed to only be able to jump can walk very slowly and laggily(is that a word?). and the player that can only walk is able to jump. Ive tried disabling the controls but it results in both of the players immobilized

Combination Script

local eventsfolder = game.ReplicatedStorage:WaitForChild("Events")
local combineEvent = eventsfolder:WaitForChild("Combine")

combineEvent.Event:Connect(function(player,otherplayer)
	print("fired")
	if player.Character:FindFirstChild("Left Leg") and not player.Character:FindFirstChild("Left Arm") then
		print("Legs")
		if otherplayer.Character:FindFirstChild("Left Arm") and not otherplayer.Character:FindFirstChild("Left Leg") then
			local NewRig = game.ServerStorage.Rig:Clone()
			--[[if player.Character:FindFirstChildOfClass("Pants") then
				player.Character:FindFirstChildOfClass("Pants"):Clone().Parent = NewRig
			end
			if otherplayer.Character:FindFirstChildOfClass("Shirt") then
				otherplayer.Character:FindFirstChildOfClass("Shirt"):Clone().Parent = NewRig
			end
			if otherplayer.Character:FindFirstChildOfClass("ShirtGraphic") then
				otherplayer.Character:FindFirstChildOfClass("ShirtGraphic"):Clone().Parent = NewRig
			end
			if otherplayer.Character:FindFirstChildOfClass("BodyColors") then
				otherplayer.Character:FindFirstChildOfClass("BodyColors"):Clone().Parent = NewRig
			end
			if player.Character:FindFirstChildOfClass("BodyColors") then
				NewRig["Body Colors"].RightLegColor3 =  player.Character:FindFirstChildOfClass("BodyColors").RightLegColor3
				NewRig["Body Colors"].LeftLegColor3 =  player.Character:FindFirstChildOfClass("BodyColors").LeftLegColor3
			end
			NewRig.Head.face.Texture = otherplayer.Character:WaitForChild("Head"):WaitForChild("face").Texture
			for i,v in ipairs(otherplayer.Character:GetChildren()) do
				if v:IsA("Accessory") then
					v:Clone().Parent = NewRig
				end
			end--]]
			local Jump =script.Jump
			local Legs = script.Legs
			Legs.Rig.Value = NewRig
			Jump.Rig.Value = NewRig
			Legs.Parent = player.Character
			Jump.Parent = otherplayer.Character
			Legs.Enabled = true
			Jump.Enabled = true	
			NewRig.Parent = workspace
			print("Spawned")
			NewRig.HumanoidRootPart.CFrame = CFrame.new(18.498, 4, 21.333)
			print("Positioned")
			task.wait(3)
			otherplayer.Character = NewRig
			player.Character = NewRig
		end
	end
end)

Player that can only walk (local script)

local player = game.Players.LocalPlayer
local userInputService = game:GetService("UserInputService")
local rig = script:WaitForChild("Rig").Value
local movement = Vector3.new(0, 0, 0)

workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
workspace.CurrentCamera.CameraSubject = rig:WaitForChild("Humanoid")
workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
player.Character = rig
player.PlayerScripts.RbxCharacterSounds.Disabled = true
userInputService.InputBegan:connect(function(inputObject, gameProcessedEvent)
	if not gameProcessedEvent then
		if inputObject.KeyCode == Enum.KeyCode.W or inputObject.KeyCode == Enum.KeyCode.Up then
			movement = Vector3.new(movement.X, movement.Y, -1)
		elseif inputObject.KeyCode == Enum.KeyCode.S or inputObject.KeyCode == Enum.KeyCode.Down then
			movement = Vector3.new(movement.X, movement.Y, 1)
		elseif inputObject.KeyCode == Enum.KeyCode.A or inputObject.KeyCode == Enum.KeyCode.Left then
			movement = Vector3.new(-1, movement.Y, movement.Z)
		elseif inputObject.KeyCode == Enum.KeyCode.D or inputObject.KeyCode == Enum.KeyCode.Right then
			movement = Vector3.new(1, movement.Y, movement.Z)
		end
	end
end)

Player that can only jump (local script)

local player = game.Players.LocalPlayer
local uis = game:GetService("UserInputService")
local rig = script:WaitForChild("Rig").Value


workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
workspace.CurrentCamera.CameraSubject = rig:WaitForChild("Humanoid")
workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
player.Character = rig
player.PlayerScripts.RbxCharacterSounds.Disabled = true

uis.InputBegan:Connect(function(input,gameproccessed)
	if gameproccessed then return end
	if input.KeyCode == Enum.KeyCode.Space then
		rig:WaitForChild("Move"):FireServer(Vector3.new(0,0,0),true)
	end
end)
1 Like

Hello, im trying to make a similar system, did you find a solution?

Did you ever find a solution? Trying to make something similar to this.