Cloned Rig not Being Rendered

Hello :smiley:

I have a problem with cloned rigs not being rendered.
I use following LocalScript under StartPlayerScripts:

local prefab = workspace.Rig
local newRig = prefab:Clone()
newRig.Name = "ClonedRig"
newRig.Parent = workspace

“ClonedRig” shows in the explorer as expected but not in-game.
When I run the same code in a Script in ServerScriptService it works fine.

Is this a bug or am I lacking certain knowledge?

2 Likes

If you clone or create anything from a local script, only the player that owns that scripts can see it, its client sided, so server doesn’t even know that exist in there, it only exist for the client.

If you do it from a server script, then, the server place the “thing” in workspace, causing replication to all clients in the game, so server and all clients can see it and interact it

1 Like

I checked the test settings. This is from the clients perspective. The existence itself isn’t the problem either, as the rig shows up in the clients explorer, but not in-game.

Thanks for the super fast reply though :smiley:

Maybe the rig is anchored and when you clone it you dont seem to set a new position for it?

Oh ok, so you only want that the client can see that rig? not the server, and you see there is a rig model in workspace of client? and the model has parts in it?.
Perhaps is in a different coordinate far from the player?

1 Like

Exactly :smiley:
I checked the cloned rigs position. It is slightly offset from the prefab rig. So not only does it show up in the explorer but it also gets pushed by the prefab as one would expect. I went over all properties again to find any clue without success and I think rendering is the only thing that doesn’t work.

1 Like

Is this the actual code you are using? Could you show more of it?
Did you try waiting for the Rig?
workspace:WaitForChild("Rig")?
Perhaps add a task.wait(5), before you prefab:Clone() line, just to check if “not already loaded” could be the reason.

Its a weird issue, I cloned rigs client side many times and I never noticed an issue where the parts are not “rendering”.

Perhaps… its dying? by any reason?

1 Like

This is all the code I am using at the moment. You were right with the task.wait(5). The cloned appears.

First of all thank you :smiley:
But now I am confused :sweat_smile: There was no error message and using

workspace.WaitForChild("Rig")

doesn’t help either. Why is waiting an abitrary amount of time the solution?

Its because the parts in the model are not ready to be cloned, thats why the task.wait(5) fixed it, it gives enough time for the model to be correctly “build” before trying to clone it. WaitForChild() is only waiting for the model, not its descendants.

You could fix it if you do the dumb task.wait(), or if you wait a step of the RunService in order stuff has chance to load after the physics happens (my bad, the RS would work for that only in a server script I think), you could try, instead of placing the model to clone in workspace store it in ReplicatedStorage, you could wait for all the parts in the model are ready before cloning it.

I tested it, yup, its because of that, you can do it like this using ReplicatedStorage:

local Player = game.Players.LocalPlayer
local CHAR = Player.Character or Player.CharacterAdded:Wait()
local prefab = game.ReplicatedStorage:WaitForChild("Rig")
local newRig = prefab:Clone()
newRig.Name = "ClonedRig"
newRig:PivotTo(CHAR.PrimaryPart.CFrame*CFrame.new(0,10,0))
newRig.Parent = workspace

Or a weird way, waiting until the Rig is complete:

local Player = game.Players.LocalPlayer
local CHAR = Player.Character or Player.CharacterAdded:Wait()
local prefab = workspace:WaitForChild("Rig")
-- wait for the model to get all its parts
repeat task.wait() until #workspace:WaitForChild("Rig"):GetChildren() >= 19 -- the number of parts in you RIG
local newRig = prefab:Clone()
newRig.Name = "ClonedRig"
newRig:PivotTo(CHAR.PrimaryPart.CFrame*CFrame.new(0,10,0))
newRig.Parent = workspace
2 Likes

Thank you sooo much :smiley:
That explains why I never had this issue before. I usually put these things in ReplicatedStorage anyways. This time I didn’t because it was just meant as quick test for something else.

Frustrating little mistake…
Thanks again!

1 Like

No problem! Glad I did help

Indeed it is, I discovered an annoying issue similar to this when I wanted to do a simply change of the CFrame of the player that is joining a new server. The player character was not ready to interact with physics engine, so, impossible to move it… The RS wait fixed it, makes sense, when player joins a new server there are some stuff still loading unless you preload it

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.