I was trying to clone a players character into a WorldModel. That did not work, so I tried to cloned each component of the character and parenting it into the WorldModel which is in the ViewportFrame. Here’s the code:
local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
character.Archivable = true
local Render = script.Parent.CharacterFrame
local Camera = Instance.new("Camera")
Render.CurrentCamera = Camera
Camera.Parent = Render
for i,child in ipairs(character:GetChildren()) do
child.Archivable = true
child:Clone().Parent = Render.WorldModel.Character
end
Camera.CFrame = CFrame.new(character.Head.CFrame.Position-Vector3.new(0,0,12),character.Head.CFrame.Position)
Basically WorldModel adds a physics to the objects/parts inside a ViewportFrame, you cannot simply parent objects to a WorldModel, you should basically keep it in a viewport frame, and then add the world model instance to the viewport frame
Can you please explain what you’ve just said, as it makes no sense to me. I’ve seen others parenting the players characters to a WorldModel, but it does not seem to work for me.
To clarify here, I believe what’s being said here is that for Worldmodel to even work at all, the must be a child of a Viewport. They go hand and hand, and a Viewport is required to make a Worldmodel work. You can still parent the Humanoid to a Worldmodel but the Worldmodel must be a child of a viewport frame if you’d like to actually see it.
When I parent the Humanoid character to the worldmodel which is a child of the viewportframe, I only see the model, not the children of the character; i.e no parts, no humanoid etc
Is it possible that the code isn’t running as intended because the descendants of character haven’t fully loaded in quite yet? To test this theory, you could add a task.wait(5) somewhere before the loop and see if it works then. If that is the case, then that is probably the issue here and can be remedied with Player.CharacterAppearanceLoaded
Okay, sorry for bumping again even though I marked this as a solution, but the player.CharacterAppearanceLoaded event is not firing at all. It’s a client sided script. And even when I connected the event to a function on the server to fire the client when the appearance has loaded, but that’s not working etiher. Rather, I’d say it isn’t firing at all.
I don’t have too much experience with CharacterAppearanceLoaded, but once I’m home I’ll be able to test that out in a couple minutes or so if no one else is able to assist. Could you send how you’re using the event quickly?
Yeah, judging by the fact this is a LocalScript you can scratch my idea of using CharacterApperanceLoaded. For whatever reason it hasn’t fired in LocalScripts for awhile, not sure if that’s a bug or a legitimate intention on Robloxs part.
I did something similar to this a couple years ago, and I think my solution was literally keeping a wait in there. I’m sure you could do something fancy like simply doing a :WaitForChild on the head (then again that would only guarentee that the head is loaded in and nothing else), or handle CharacterApperanceLoaded on the server and fire a remote (imo thats overcomplicating it tbh), but for whatever reason I don’t believe CharacterApperanceLoaded will fire in a localScript.
Stumbled across this thread and thought I’d mentioned how I got around the CharacterAppearanceLoaded() issue.
In my case, for some reason R15 character models can’t be cloned into a worldmodel after the function call CharacterAppearanceLoaded() fires inside a LocalScript, worked perfectly fine before with R6, but not R15.
I had to use CharacterAdded() instead and it works perfectly fine now.