Looking to figure out a way to swap control & camera focus between two rigs without respawning or cloning either of them?

I’m trying to have it so that when I click the SWAP button, keyboard control switches over to the big guy in the back. The methods I have found end up deleting the original player model if I switch the Player.Character property and respawning me, and I can’t do that because this is for my character in a roleplay game and respawns will mess up the character customization stuff.

I also plan to have an animation play where the original player character climbs up onto the back of the big guy and accesses a completely different button set so generally it’s just important the two models do not get cloned or deleted.

I was thinking a potential solution would be to just set the player’s PlatformStanding to true, bind WASD, Shift and Spacebar to different movement things in a LocalScript and have that move the big guy around, but I’m not sure where to find documentation or tutorials on how to do that. If someone has the method or knows where to learn please direct me!

1 Like

Swapping the actual character of the player will delete the original, that just how it works. You’re gonna wanna change what the local players CameraSubject to be the other rig’s humanoid root part instead. Yes this has to be done in a local script since its the players camera.

For controlling the other rig, I don’t really know. Unless you were to find out how to keep the old character and actually switch to the new one, I think the only way would be to disable the original player movement and then use something like the UserInputService to get movement bindings, or preferably use the ContextActionService instead.

I don’t know if there is a way to keep the previous rig and set the character without breaking something. There seems to also be an old unresolved post about this:

1 Like

Keep the reference and reparent it to the workspace:

local char = Plr.Character
Plr.Character = NewChar
char.Parent = workspace
1 Like

I decided to just set my avatar’s WalkSpeed = 0 and switch the CurrentCamera subject to the big guy, but for some reason when I use RS:BindToRenderStep, the function with Humanoid:Move() is not working?

local UIS = game:GetService("UserInputService")
local RS = game:GetService("RunService")
local PlrCharacter = game.Players.LocalPlayer.Character
local Remote = script.Parent.Parent.Parent.ServerInfo
local Frank
local Humanoid
local keyCode = {}

Remote.OnClientEvent:Connect(function(FrankRig)
	PlrCharacter.Humanoid.WalkSpeed = 0
	Frank = FrankRig
	Humanoid = Frank.Humanoid
	workspace.CurrentCamera.CameraSubject = Humanoid
end)

UIS.InputBegan:Connect(function(key, gameProcessed)
	if key.KeyCode == Enum.KeyCode.W then keyCode.W = true
	elseif key.KeyCode == Enum.KeyCode.A then keyCode.A = true
	elseif key.KeyCode == Enum.KeyCode.S then keyCode.S = true
	elseif key.KeyCode == Enum.KeyCode.D then keyCode.D = true
	elseif key.KeyCode == Enum.KeyCode.Space then keyCode.Space = true
	end
end)

UIS.InputEnded:Connect(function(key, gameProcessed)
	if key.KeyCode == Enum.KeyCode.W then keyCode.W = false
	elseif key.KeyCode == Enum.KeyCode.A then keyCode.A = false
	elseif key.KeyCode == Enum.KeyCode.S then keyCode.S = false
	elseif key.KeyCode == Enum.KeyCode.D then keyCode.D = false
	elseif key.KeyCode == Enum.KeyCode.Space then keyCode.Space = false
	end
end)

local function Move()
	if keyCode.W == true then
		Humanoid:Move(Vector3.new(0, 0, -1), true)
		print("W")
		print(Humanoid)
		print(Humanoid.Parent)
	end
end

RS:BindToRenderStep("MoveFrank", 1, Move)

I’ve tested it in studio and the print statements run just fine, the variables they’re printing are referencing the correct things. and I get no errors, so something else is preventing the big guy from moving. EvaluateStateMachine is enabled and nothing is anchored, so I don’t know what it could possibly be.

It could be because you’re running the move command on the client, and since technically its not you character.

You could try setting the network owner of the “Frank” rig to be you, as it might work, I don’t know but based off the documentation it seems network owner plays a part here.

You might have to fire the move command on the server. :face_with_diagonal_mouth:

1 Like

Setting the network owner of the baseparts in the rig was enough to get the function to start working, thanks for the help!

1 Like

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