What do you want to achieve?
I am trying to make a rig that loads the local player’s character model, and faces towards them
What is the issue?
The rig faces the character fine, however, attempting to load the rig gives this error:
HumanoidDescription is not a valid member of Humanoid “Workspace.ObbyParts.menacingman1.Humanoid” - Client
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have searched on the forums for loading characters to rigs, however I have not found anything useful.
Script:
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local humanoid = char.Humanoid
local npc = script.Parent
local npchumanoidrootpart = npc.HumanoidRootPart
local npchumanoid = npc.Humanoid
local Players = game:GetService("Players")
npchumanoid.HumanoidDescription = Players:GetHumanoidDescriptionFromUserId(player.UserId)
while true do
local char = player.Character or player.CharacterAdded:Wait()
local humanoidrootpart = char.HumanoidRootPart
npchumanoidrootpart.CFrame = CFrame.new(npchumanoidrootpart.Position, char.Head.Position)
wait(0.1)
end
You probably have to create the NPC on the client. A fast solution is to move the script outside of the NPC and then clone it and destroy the old one.
local serverNpc = script.Parent.NPC
local clientNpc = serverNpc:Clone()
serverNpc:Destroy()
clientNpc:ApplyDescription(Players:GetHumanoidDescriptionFromUserId(player.UserId)
This isn’t the best solution because now the client will have its own version of the NPC that won’t replicate to other players. If you can, I would probably do this on a server script.