Well then, can you print out npc:GetDescendants()
before and after the for loop, alongside its #? Just to see if there are any discrepancies between the two, maybe the character wasn’t loaded properly?
This is what I got after:
print(#npc:GetDescendants(), npc:GetDescendants())
You need to enable printing tables in the output console settings because here, it shows the address of the first element of the table
And what did you get before?
Also, did you try to use LocalTransparencyModifier instead of Transparency? Not that it could solve the issue, it’s just better in your use case.
So using LocalTransparencyModifier did not work and where do I enable that?
Hm, alright so, to make a recap.
The server creates an NPC copy of the rig in RS. It parents it to chaseSystemAssets (which I believe replicates to the client as well*)
It then sends the NPC to the target client. The client then runs the for loop to set the transparency of every basepart and decals to 0 (except for specific ones that you filter by name).
→ Where is “chaseSystemAssets” located? I believe it is in the workspace (my personal guess)
ChaseSystemAssets is located in workspace
Normally the table should be displayed in the console, I’m kind of confused why it doesn’t display the table itself. You silented the “print(v)” step inside of the for loop. What does it print right now?
Can you show the rig in question in RS? The model with all its children, and expand the Humanoid as well please
Hm… Can you print the npc:GetDescendants() and its # on the script (before it sends it to the client), and print the same thing on the client upon receiving the model?
This is what I wrote:
print(#npc:GetDescendants(), npc:GetDescendants())
It looks like the amount of descendants is lower in the clientsided version than it is in the serversided version. That’s why it can’t find the parts
What you can do is send the descendants list by remote event directly, not the model, I’m unsure on whether or not it’ll work, but that’s definitely odd
Hm yeah but I have a question on how I can fix this so that we have a better understanding on what’s getting deleted yk
Did the last reply from Varonex work? If not, I cleaned your code a bit in case of any hard to see logic errors. I’ll give two potential solutions. One uses GetDescendants like you, the other uses GetChidren which has better performance if it works. Try the first one and if it works, try the second. Here they are:
With GetDescendants
game.ReplicatedStorage:WaitForChild("showNpc").OnClientEvent:Connect(function(npc)
local ignoreList = {"CamPartGoal", "HumanoidRootPart"} --Added ignore list to remove if-statement nesting
print(npc)
for _, v in npc:GetDescendants() do --Removed pairs since it's not needed here
print(v)
if v:IsA("BasePart") or v:IsA("Decal") then --Changed to use IsA, and added "or" to remove elseif block
print(v, "is a valid class")
if table.find(ignoreList, v.Name) then --Changed logic order to remove if-statement nesting
print(v, ": is in ignore list.")
continue
end
v.Transparency = 0
print(v, "transparency set")
end
end
print("Done")
end)
With GetChildren
game.ReplicatedStorage:WaitForChild("showNpc").OnClientEvent:Connect(function(npc)
local ignoreList = {"CamPartGoal", "HumanoidRootPart"} --Added ignore list to remove if-statement nesting
print(npc)
for _, v in npc:GetChildren() do --Removed pairs since it's not needed here
print(v)
if v:IsA("BasePart") or v:IsA("Decal") then --Changed to use IsA, and added "or" to remove elseif block
print(v, "is a valid class")
if table.find(ignoreList, v.Name) then --Changed logic order to remove if-statement nesting
print(v, ": is in ignore list.")
continue
end
v.Transparency = 0
print(v, "transparency set")
end
end
print("Done")
end)
I’ve also changed some of the prints to better reflect what’s happening and added comments to explain some of the changes. Hope this helps!
I can understand how this script works but why isn’t it working? I get no errors in console here is what gets printed:
I think the issue is that the instances disappear
But here’s also the issue at the moment all of the parts are set to transparency = 1 and the script is supposed to set them to transparency = 0 but when I set all the parts transparency to 0 before playing the game and play the game everything seems fine, so I don’t know why these parts are going missing on the script
Can someone help me on this issue thanks
Turn off log mode in the output window
Alright so apparently I’m getting this error
Can someone help me here, I’m stuck on this issue for a while now…