I want to know another script where you can try the hats to. I made a script where if you want to try them on, you would click on try. But it gave an error. This is the script:
dist = 10
function onClicked()
local players = game.Players:GetChildren()
for i = 1, #players do
if (players[i].Character.Torso.Position - script.Parent.Position).magnitude < dist then
local name = players[i].Name
local f = game.Workspace:FindFirstChild(name)
local s = f:FindFirstChild("Shirt")
local p = f:FindFirstChild("Pants")
local s1 = script.Parent.Parent.Parent.Clothes.Shirt:clone()
local p1 = script.Parent.Parent.Parent.Clothes.Pants:clone()
s.Parent = script.Parent.Parent.PlayerStorage
p.Parent = script.Parent.Parent.PlayerStorage
wait()
s1.Parent = f
p1.Parent = f
wait(5)
s1:remove()
p1:remove()
s.Parent = f
p.Parent = f
end
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
Error:
13:42:56.616 - Clothes is not a valid member of Model
