Player replication system doesn't work properly

What do you want to achieve?
I’m currently trying to make an actual game in a viewport frame; so far, it works pretty well. You can move around, jump, and even climb ladders.

What is the issue?
Well, I want to add player replication. It spawns the character, but then doesn’t update anything. They’re just standing there, motionless. image

What solutions have you tried so far?
I’ve tried basically everything I could think of. Changing little details, and many other things. However, no matter what I do, it doesn’t work.

Here’s the spawning character code I have so far:

game.Players.PlayerAdded:Connect(function(plr)
	if plr.Name ~= loplr.Name then
		plr.CharacterAdded:connect(function(char)
		-- Now that we have a function, lets clone stuff
		char.Archivable = true
		local clonedModel = char:Clone()
		clonedModel.Parent = viewport
		char.Archivable = false
		local function UpdatePlayerMovement2() -- updates player movement
			local chary = clonedModel:GetChildren()
			local chars = char:GetChildren()
			for i, v in pairs(chary) do
				if chary[i]:IsA('BasePart')  then
					chary[i].CFrame = char[chary[i].Name].CFrame
				elseif chary[i]:IsA('Accessory') then
					chary[i].Handle.CFrame = char[chary[i].Name].Handle.CFrame
				end
			end
		end

		RunService.RenderStepped:connect(function()
			UpdatePlayerMovement2()
		end)

	    end)
	end
end)

If you require me to send the place file, I can

All help is appreciated!

also this is my first post here on the devforum did i do good

I somehow managed to get it working by basically rewriting all of the code.

1 Like