I made a script that stores your character's clothes and applies them back to your character if you speak the phrase "/clothes." However, when I do this, I get the error Image failed to load Workspace.Player1.Humanoid Clothes : http://www.roblox.com/asset?id= because Request failed and the Shirt/PantsTemplate of the clothing just shows the 'prefix.' Here is the script:
local Prefix="http://www.roblox.com/asset?id="
game.Workspace.ChildAdded:connect(function(char)
if char:FindFirstChild("Humanoid") then
local p = game.Players:FindFirstChild(char.Name)
if p then
if char:FindFirstChild("Shirt") then
sh = char.Shirt.ShirtTemplate:sub(31)
else
local d = Instance.new("Shirt")
d.Parent = char
d.Name = "Shirt"
sh = d.ShirtTemplate
end
if char:FindFirstChild("Pants") then
pa = char.Pants.PantsTemplate:sub(31)
else
local d = Instance.new("Pants")
d.Parent = char
d.Name = "Pants"
pa = d.PantsTemplate
end
end
end
end)
function onChatted(msg, recipient, speaker)
msg = string.lower(msg)
if (msg:lower() == "/clothes") then
speaker.Character.Pants.PantsTemplate = Prefix..tostring(pa)
speaker.Character.Shirt.ShirtTemplate = Prefix..tostring(sh)
end
end
function onPlayerEntered(newPlayer)
newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end)
end
game.Players.ChildAdded:connect(onPlayerEntered)
Please help.
