Hello. I am new to developing in Roblox as well as to the forum, so if this comes off as poorly researched or hard to read, I apologize.
What do I want to achieve?
I want to create an NPC that can replicate the player’s movement. The NPC would have to precisely replicate these movements, so to do this I record the player’s parts’ CFrames every frame, and then replay them but with the NPC’s parts. The NPC would have a different avatar to the player, which is what makes the task challenging.
What is the issue?
In order to achieve this, the size of the NPC’s parts have to be the same as the players. The main issue is that since there are so many different avatars, it is hard to standardize the sizes without breaking some players’ avatars. I do not want to change the player’s avatar in any major way (I am fine with removing certain UGC items if necessary, but I don’t want to mess up their avatar by removing their hair, for example). I also do not want to set the NPC’s part sizes to the player’s, as that can allow parts of my game to be spoofed.
What solutions have you tried so far?
I have tried using avatar settings, however I don’t think it is able to precisely change the sizes of each part. I tried to set the player’s part sizes when they join the game with a script, however this seems to break parts of their character (welds and animations, from what I have seen).
In Summary: Is there some easy way to set the player’s proportions without completely breaking their character?
This would help, however I think that players have different sizes per part. Also, if I set the size of each part individually, I think the animations/welds might break.
Another thing I have to consider is that players might have different types of parts? I am not sure how much of an impact this would have, but I hope there could be a way to set a default torso/arm
I don’t entirely understand your needs, but I’m assuming you just want to scale the model of the player. (Correct me if I’m wrong then we can work something out from there)
This post might be what you’re looking for:
Characters usually have standard sizes (if it’s R6) so you can just use an R6 model for the NPC.
I’m pretty sure there’s also an API that allows you to have a character copy another avatars properties 1:1 if that’s what you’re looking for.
My question centers around how to make the player exactly the same size as the NPC. I would just scale the whole player to the size of the NPC, but the avatars of players are vastly different, and they might have, say, a different ratio of torso to arm for example. I want to know if there is a way to force players to have certain proportions without breaking their animations, welds or textures.
This code prints the size of a LeftUpperLeg (of an R15 avatar). To set the size of a part to the character’s LeftUpperLeg size on the server side, you need a RemoteEvent, a script and a LocalScript.
This would be in a LocalScript:
local val = game.Players.LocalPlayer.Character:FindFirstChild("LeftUpperLeg").Size
game.Workspace.SetSize:FireServer(val)
This would be in a ServerScript:
script.Parent.OnServerEvent:Connect(function(plr, val)
workspace.SizePart.Size = val
end)
I have been busy with other things, and as such I haven’t had time to check the Roblox Devforum in a bit, so I apologize for the late reply.
After forcing the player to R6, and then using avatar settings to set the main parts of the player (arms, legs) to the ones of the NPC, my system worked! I was stuck on this for months, and I am really grateful for all the help.