I’m making it so all characters are rendering locally by creating them locally and welding them to the actual player in workspace, but when I do this the position of the actual player stops replicating? I don’t understand, I’ve tried all the fixes I could think of, but nothing worked. Nothing in the model is anchored either.
That didn’t solve it I also tried to swap Part0, Part1 and the Parent and I got excited as it worked the first three times I started a server and tested, then the 4th the same thing happened!!
I would just tween the HumanoidRootPart’s CFrame to the CFrame of the server side HumanoidRootPart every 0.1 seconds, but I’m not sure if that would be more efficient than a weld.
Ohhhh I see what you’re doing - this is exactly what I was doing a few weeks ago with my enemy system and it had some strange replication issues. It’s more than likely because it’s to do with Humanoids in the server side character. Making the local character a separate object (not joined by welds) might be your best bet, but I don’t know. If you do find out why this happens or a good solution, please post it on here because I think this could help me too.
But yeah tweening every .1 seconds sounds like it would fix the replication. Not sure if it’s efficient though.
Yeah, that’d be the problem. Are you more concerned about performance issues because of the tweening, or because of updating every .1 seconds?
I’m pretty sure most games on Roblox that use custom characters update them several times a second - I think I heard Phantom Forces updates theirs 12 times per second. Maybe instead of TweenService, you could just lerp them because then you can control how smooth it is, but I don’t know which is more efficient. Do some tests and see how it does, I guess.
I don’t think this topic is about animations, it’s more about custom character replication.
Also @vsnry, I’ve recently used TweenService for animating a projectile, and it works fine. It’s using a bezier curve and it goes to several points along a path but works without lag. Use TweenService for now - you can always change it later.
I do not understand why this doesn’t work… I just tried Motor6D’s and they behaved exactly the same way, I don’t know what to do any more as I can’t CFrame the characters since I need the .Touched behaviour to work on the body parts.
Another alternative is to create an Attachment, AlignPosition, and AlignOrientation into the new character. Setting these constraints to rigidly align the new character to the old character should do the trick.
You could also set it so that the game does not use :LoadCharacter() or AutoLoadCharacter and do a custom character. You can do this by having the server set the Player.Character to a model with a HumanoidRootPart brick and Humanoid in it, then have the client build the character around the new character on CharacterAdded.
-- Server
local nc = Instance.new("Model")
local hrp = Instance.new("Part", nc)
hrp.Size = Vector3.new(2,2,1)
hrp.Name = "HumanoidRootPart"
hrp.Transparency = 1
local hum = Instance.new("Humanoid", nc)
game.Players.PlayerAdded:Connect(function(p)
wait(1)
local x = nc:Clone()
x.Parent = workspace
x.HumanoidRootPart:SetNetworkOwner(p)
p.Character = x
end)
-- client
game.Players.LocalPlayer.CharacterAdded:Connect(function(char)
print(char.HumanoidRootPart, char.Humanoid)
end)
You can do this by having the server set the Player.Character to a model with a HumanoidRootPart brick and Humanoid in it, then have the client build the character around the new character on CharacterAdded.
That is exactly what I’m doing, except the character doesn’t work if there is no head and when I weld the custom character locally the position stops replicating. I will try your “AlignPosition and AlignOrientation” method tomorrow and see how it goes!
So AlignPosition and AlignOrientation worked fine, until I tried to teleport the character by setting the CFrame to a different place and then it ended up glitching out like the rest of the welds and stuff I tried. I guess the only way to make this work properly is just to tween CFrame…