I am trying to make a script which gives me a certain hat and face when I join the game but before it does it removes my hat, I have the hats in the Workspace so when I join it changes there parents to my player, and for the face it changes my face texture ID. What I have so far:
local d = game.Workspace.Vividex
for i=1, #d do
if (d[i].className == "Hat") then
d[i]:remove()
end
end
end
wait(1)
function OnPlayerEntered(player)
if player.userId == 39704067 then
game.Workspace["Clockwork Headphones"].Parent = Workspace.Vividex
game.Workspace.WhiteTopHat.Parent = Workspace.Vividex
game.Workspace["Ultra-Fabulous Hair Pink"].Parent = Workspace.Vividex
game.Workspace.Vividex.Head.face.Texture = "http://www.roblox.com/asset/?id=26727653"
end
end
game.Players.ChildAdded:connect(OnPlayerEntered)
but when I enter the game it makes the hats disappear and doesn't remove my hat, plus, I'm not sure when I reset the hats still stay on me. Please help?

1 comment
Now that I read it, I'm not sure if I did this right.