Client Side Accessories

What do you want to achieve?
I’m working on a client sided character customization screen.

https://thumbs.gfycat.com/PlaintivePracticalIzuthrush-mobile.mp4
There is a single Dummy model in the server. Every client shares this dummy model and changes properties such as the face, skin color, shirt, and pants on the server side.

What is the issue?
If you parent an accessory to a character on the client side, it doesn’t position or weld the handle to the character like it would normally on the server side.

Possible solutions?
I’ve got a few ideas for half-baked solution

  1. have hats be server sided and have the client side delete any hats that the user’s not meant to see.
    (not very elegant)

  2. Have a function that takes a hat specified by the client side, parents it to the dummy on the server side, then gives it back to the client side as fast as possible with the correct positioning.
    (This would be especially bad since clients might see flashes of hats appearing and disappearing seemingly at random if multiple people were customizing their character at once)

  3. Have a separate dummy for each player inside a viewportframe and have the server side parent the hats inside the dummies.
    (would this even work?)

  4. Have the hats’ handle be anchored and positioned to where it would normally be by default.
    (would be bad because the hats won’t follow the character’s animated head)

  5. Manually calculate the position :skull:
    (OOF)

Are there any better solutions?

1 Like

Why not parent the accessory in the server then? After the customization is done, you send the information of what the character would look like to the server and apply it there! Or Am I not understanding this and there is a problem?
Another thing you can do but that might create issues due to the constant remote events sending signals, is make a real-time thing where any change done to the character from the client is instanly applied in the server instead of customizing the whole character than sending it all

1 Like

I’m also working on something like this and I (think) have an answer for that. I’ve done something similar (I’m writing on an iPad and can’t control roblox studio now):

[[--LocalScript--]]
script.Parent.FireServer(game.Players.LocalPlayer, "BlockHead")
[[--ServerScript--]]
local TableForMesh = ["BlockHead" = "ID Of Mesh"]
local TableForTexture = ["BlockHead" = "ID Of Texture"]
game.ReplicatedStorage.RE.OnServerEvent:Connect(function(player, Key)
    local MeshID = nil
    local TextureID = nil
    for Index, Mesh in pairs(TableForMesh)do
        if Index == Key then
           MeshID = Mesh
        end
    end

for Index, Texture in pairs(TableForTexture)do
        if Index == Key then
           TextureID = Texture
        end
    end
local Hat = Istance.new("Part", player.Character)
local Mesh = Istance.new("SpecialMesh")
Hat.Size = player.Character.Head.Size
Hat.Position = player.Character.Head.Position
Hat.CanCollide = false
Mesh.MeshID = MeshID
Mesh.Texture = TextureID
Mesh.Offset = Vector3.new(0,0.6,0)
--Then Weld the Hat with the Part and it should working
end)
1 Like

Did you try adding the accessories via Humanoid Descriptions.

1 Like

Thank you for your replies but I still have the problem.

@starmaq
@Eternalove_fan32
As I mentioned in the original post, I have the entire customization local sided.
If I were to make hats be server sided, as all players share the same dummy, everyone would be trying to customize the same dummy all at once.
Here’s more info about server vs client side

@Romeo_Duncan
Thanks for the tip.
I just tried it and sadly Humanoid:ApplyDescription() can only be called by the backend server

Well why don’t you try giving each player there own dummy on the server, and detect when its added on the client and if its not that player’s dummy you destroy it locally, you could name each dummy the player’s UserId, and then you use remote events to apply the description to each dummy on the server.

Oh and btw i dont think you would see flashes of the other dummy’s accessories if its destroyed on the other clients because accessories get parented to the dummy model

2 Likes

That’s one plausible solution, however, it’s not very elegant.
I was wondering if there was a better alternative

Try searching before you create a thread, I’ve seen at least 5 Threads with the same issue.

2 Likes