Can you show an example of the accessory in-studio + send a video of what it looks like when the script is run??
https://developer.roblox.com/en-us/api-reference/function/Humanoid/AddAccessory
Might be worth reading up on AddAccessory(), the BasePart instance named “Handle” inside the Accessory instance requires an Attachment instance inside of it matching the name of an Attachment instance inside the humanoid’s parent (character model), if these conditions are satisfied the BasePart instance is welded to the Attachment instance of the character model in such a way that both Attachment instances occupy the same space.
Could you try this
local Event = game.ReplicatedStorage:WaitForChild("RemoteEvent1")
local Character = nil
local style = nil
local humanoid = nil
local char = workspace:WaitForChild("CharSelectDummy")
Event.OnServerEvent:Connect(function(player, styleType)
Character = player.Character or player.CharacterAdded:Wait()
humanoid = char:WaitForChild("Humanoid")
if styleType[1] == "Hair" then
-- Hair types
if (styleType[2] == "1") then
style = player.PlayerGui.CharCreationScreen.HairScrollingFrame.ViewportFrame1.Hair:Clone()
style.Parent = game.ReplicatedStorage
humanoid:AddAccessory(style)
end
end
end)
Well, is there a way to send client instances to server?
What do you mean by client instances? Like an instance created by the client?
Just as an FYI, you do not need to use Player.CharacterAdded:Wait()
here. It’s inappropriate. In this situation, you should avoid continuing with the function should the player’s character not exist:
local character = player.Character
if not character then
return
end
Yes, the client script makes part and sending it to server through RemoteEvents.