Trying to insert assets into a character model inside CurrentCamera


#1

I am trying use InsertService and LoadAsset to get an asset from Roblox, and load it onto a character model that’s located inside CurrentCamera. I’m trying to create like a character customisation screen. The character model is located in CurrentCamera because I want each character to look different for each player (depends what each player sets it to look like)

The problem is that when I tested in studio, InsertService and LoadAsset work perfectly fine in play solo, but not online. Even though the wiki states that you can use both these in both Local and Server scripts.

I have tried using a RemoteEvent to fire to the server, load the asset in the server, parent it to the workspace, then when an item gets added to the workspace, the LocalScript clones it and parents the clone to the character model, then deletes the original model. This has just resulted in the item being cloned to the position of wherever it is loaded (not attached to the dummy model in the correct spot)

I’ve also tried :AddAccessory, but that just did the same thing. For some reason the item won’t get attached to the character model.


The accessory is currently being parented to the character model just for testing, so don’t say I can just parent it in the Server script because I’m trying to get it to be parented to the Character in CurrentCamera and just purely parenting it to the players character just to see if it was actually attaching wrong or just being placed there and anchored, and as you can see it is just sitting there, instead of actually being welded or anything like it should be.

I don’t know what else to do, but I know it’s possible because I’ve seen it done in games like AR2 and Island Royale.


#2

Firstly, you can put your code in a code block on the DevForum by writing this:

```
your code here
```

This will make reading & modifying the code much easier for everyone.
You can also take screenshots and upload them on here by using free tools like gyazo or Lightshot, if you need to show any pictures.


Now, as for your issue, it sounds like it could be less of an issue with InsertService and more to do with your other code.

So, have you verified that everything up to the InsertService stuff is working?

At this stage you might as well use the first version you came up with (client side only) as it’s simpler and easier to debug.


#3

Well I mean it’s inserting the accessory, but if inside the server script I set it’s parent to immediately be say a players character then it automatically puts it on the players character in the correct spot. Same thing if I was to parent it to a character model inside workspace, it works fine. But that can only be done server side. CurrentCamera can’t be checked from the server, so local parts inside it are basically invisible, but if I parent the accessory to anything else and then try reparenting it later it doesn’t weld properly to the charcter model


#4

I put a dummy model inside workspace to show that when I do just parent it straight to a character model it works perfectly. But like I said in my question at the start, it doesn’t want to parent properly when I want it to be parented inside the CurrentCamera

giveHat.OnServerEvent:Connect(function(player)
	local item = game:GetService('InsertService'):LoadAsset(553869736)
	local hat = item:GetChildren()[1]
	hat.Parent = workspace.Dummy
	item:Destroy()
end)

That’s what I used to parent it to the dummy in the workspace. Before I was parenting it to a folder, then getting it from that folder and putting it into the dummy inside the CurrentCamera. Is there to NOT parent it in the server? I’ve tried firing the remoteEvent back with hat and item being the parameters but it just sends it as nil. I think it’s the fact that I’m parenting it somewhere else first. It needs to be immediately parented to the character model inside the camera, or else it won’t work.


#5

workspace.CurrentCamera.Dummy.Humanoid:AddAccessory(clone)

Ended up going back and trying AddAccessory, still doesn’t put it on the model tho. You can see in the picture, the wings just get put wherever they want and aren’t being attached the character like normal. What’s frustrating is I’ve tried numerous ways at trying to get this to work, and every single way works perfectly fine with Play Solo. But the second I to a test server it doesn’t work and I don’t get why it would give 2 completely different results


#6

Humanoid:AddAccessory() doesn’t work via LocalScript it’s a know issue.

@NinjoOnline

That’s because you don’t understand how Filtering Enabled & Server-Client works.

You can read more here


#7

So I have to load the asset into say like a folder, then get the asset from the folder and fire the function addAccoutrement?


#8

No.

addAccoutrement(character, accoutrement)

Just that no need to put it in a folder

then you can delete the Model you Inserted


#9

Well I gotta insert the model somewhere, and I don’t want to insert it into the workspace, I got it working tho dw :smiley: