– Server
RetrieveItem.OnServerEvent:Connect(function(player, assetType, id)
local AssetTypeId = MarketplaceService:GetProductInfo(id).AssetTypeId
if AssetTypeId ~= 8 and AssetTypeId ~= 11 and AssetTypeId ~= 12 and AssetTypeId ~= 18 and AssetTypeId ~= 41 and AssetTypeId ~= 42 and AssetTypeId ~= 43 and AssetTypeId ~= 44 and AssetTypeId ~= 45 and AssetTypeId ~= 46 and AssetTypeId ~= 47 then
return
end
local Success, Model = pcall(function()
return InsertService:LoadAsset(id)
end)
if Success then
for i,v in pairs(Model:GetDescendants()) do
if v:IsA('LuaSourceContainer') or v:IsA('BackpackItem') then
v:Destroy()
end
end
local Accessory = Model:GetChildren()[1]
local CurrentFolderItem = CustomiseHolder:FindFirstChild(assetType)
if assetType == 'Hat' or assetType == 'Hair' or assetType == 'Accessory' then
Accessory.Name = assetType .. ' - ' .. id
Accessory.Parent = CustomiseHolder.Accessories
wait()
Accessory:Destroy()
else
if assetType == 'Face' then
CurrentFolderItem.Texture = Accessory.Texture
elseif assetType == 'Shirt' then
CurrentFolderItem.ShirtTemplate = Accessory.ShirtTemplate
elseif assetType == 'Pants' then
CurrentFolderItem.PantsTemplate = Accessory.PantsTemplate
end
Accessory:Destroy()
end
Model:Destroy()
end
end)
– Client
CustomiseHolder.Accessories.ChildAdded:Connect(function(accessory)
wait()
local Hat = 0
local Hair = 0
local Accessory = 0
for _, v in pairs(Dummy:GetChildren()) do
if v.Name == accessory.Name then return end
if string.sub(accessory.Name, 1, 6) == 'Hat - ' then
if string.sub(v.Name, 1, 6) == 'Hat - ' then
Hat = Hat + 1
if Hat >= 5 then
return
end
end
elseif string.sub(accessory.Name, 1, 7) == 'Hair - ' then
if string.sub(v.Name, 1, 7) == 'Hair - ' then
Hair = Hair + 1
if Hair >= 5 then
return
end
end
elseif string.sub(accessory.Name, 1, 12) == 'Accessory - ' then
if string.sub(v.Name, 1, 12) == 'Accessory - ' then
Accessory = Accessory + 1
if Accessory >= 5 then
return
end
end
end
end
local Attach0 = accessory.Handle:FindFirstChildWhichIsA('Attachment')
local Attach1 = Dummy:FindFirstChild(Attach0.Name, true)
local Weld = Instance.new('Weld')
Weld.Parent = accessory.Handle
Weld.Part0 = Attach0.Parent
Weld.Part1 = Attach1.Parent
Weld.C0 = Attach0.CFrame
Weld.C1 = Attach1.CFrame
accessory.Parent = Dummy
end)
Problem is, if you have 2 players on, one player retrieves an item, they both end up getting it on their dummy. How can I go about making it so only the player who requested the item gets said item