I’ve been using this cute mannequin model where it shows a selected box around the mannequin’s body parts when a player hovers their mouse over it. Then, a small gui pops up, where the player can try on and buy the clothing.
This seems to work fine!
However, when you try on the clothing, it does not show you wearing the selected clothing to other players. So it only works for individuals.
Any ideas how I can fix it so the clothing you try on appears to everyone in the server on your character?
This is the script I’m using:
local player = game:GetService("Players").LocalPlayer
local mouse = player:GetMouse()
local userInput = game:GetService("UserInputService")
local runService = game:GetService("RunService")
local marketplaceService = game:GetService("MarketplaceService")
local mannequinsFolder = workspace:WaitForChild("Mannequins")
local selected = ""
local root = script.Parent
local mainFrame = root:WaitForChild("MainFrame")
local tryButton = mainFrame:WaitForChild("TryButton")
local buyButton = mainFrame:WaitForChild("BuyButton")
local cancelButton = mainFrame:WaitForChild("CancelButton")
function setAllOff()
for mannequinIndex, mannequinFolder in pairs(mannequinsFolder:GetChildren()) do
for selectionIndex, selectionBox in pairs(mannequinFolder.SelectionBoxes:GetChildren()) do
selectionBox.Visible = false
end
end
end
runService:BindToRenderStep("MouseHover", Enum.RenderPriority.Camera.Value - 1, function()
local target = mouse.Target
if target and target:IsDescendantOf(mannequinsFolder) then
local mannequin = target.Parent
local shirt = mannequin:FindFirstChild("Shirt")
local pants = mannequin:FindFirstChild("Pants")
local selectionFolder = mannequin:FindFirstChild("SelectionBoxes")
if target.Name == "Left Arm" or target.Name == "Right Arm" then
setAllOff()
if shirt.ShirtTemplate ~= "" and shirt.ShirtTemplate ~= "rbxassetid://" then
selectionFolder["Right Arm"].Visible = true
selectionFolder["Left Arm"].Visible = true
selectionFolder["Torso"].Visible = true
end
elseif target.Name == "Torso" then
setAllOff()
if shirt.ShirtTemplate ~= "" and shirt.ShirtTemplate ~= "rbxassetid://" then
selectionFolder["Right Arm"].Visible = true
selectionFolder["Left Arm"].Visible = true
selectionFolder["Torso"].Visible = true
else
selectionFolder["Right Leg"].Visible = true
selectionFolder["Left Leg"].Visible = true
selectionFolder["Torso"].Visible = true
end
elseif target.Name == "Left Leg" or target.Name == "Right Leg" then
setAllOff()
if shirt.ShirtTemplate ~= "" and shirt.ShirtTemplate ~= "rbxassetid://" then
selectionFolder["Right Leg"].Visible = true
selectionFolder["Left Leg"].Visible = true
else
selectionFolder["Right Leg"].Visible = true
selectionFolder["Left Leg"].Visible = true
selectionFolder["Torso"].Visible = true
end
end
else
setAllOff()
end
end)
mouse.Button1Down:Connect(function()
local target = mouse.Target
if target and target:IsDescendantOf(mannequinsFolder) then
local mannequin = target.Parent
local shirt = mannequin:FindFirstChild("Shirt")
local pants = mannequin:FindFirstChild("Pants")
if target.Name == "Left Arm" or target.Name == "Right Arm" then
if shirt.ShirtTemplate ~= "" and shirt.ShirtTemplate ~= "rbxassetid://" then
selected = shirt
end
elseif target.Name == "Torso" then
if shirt.ShirtTemplate ~= "" and shirt.ShirtTemplate ~= "rbxassetid://" then
selected = shirt
else
selected = pants
end
elseif target.Name == "Left Leg" or target.Name == "Right Leg" then
if shirt.ShirtTemplate ~= "" and shirt.ShirtTemplate ~= "rbxassetid://" then
selected = pants
else
selected = pants
end
end
buyButton.RoundFrame.Label.Text = "Buy " .. selected.Name
mainFrame.Visible = true
end
end)
tryButton.MouseButton1Down:Connect(function()
local character = player.Character
if player.Character then
if character:FindFirstChildOfClass(selected.ClassName) then
character:FindFirstChildOfClass(selected.ClassName)[selected.Name .. "Template"] = selected[selected.Name .. "Template"]
else
local clone = selected:Clone()
clone.Parent = character
end
end
end)
buyButton.MouseButton1Down:Connect(function()
marketplaceService:PromptPurchase(player, selected.AssetId.Value)
end)
cancelButton.MouseButton1Down:Connect(function()
mainFrame.Visible = false
end)
Thanks in advance!