Not sure why, can you help me?

game.ReplicatedStorage.remoteEvents.equipTrail.OnServerEvent:connect(function(player,plr,item,has)
	repeat wait() until player.Character
	if player.Character.Head["Trail"] then
		player.Character.Head["Trail"]:Clear()
	end
	if player.Character.Head["TrailAttachment0"] then
		player.Character.Head["Trail"]:Clear()
	end
	local trail = game.ServerStorage.trails[item]:Clone()
 	 trail.Parent = player.Character.Head
trail.Name="Trail"
  	local attachment0 = Instance.new("Attachment",player.Character.Head)
  attachment0.Name = "TrailAttachment0"
   local attachment1 = Instance.new("Attachment",player.Character.HumanoidRootPart)
  attachment1.Name = "TrailAttachment1"
 trail.Attachment0 = attachment0
 trail.Attachment1 = attachment1
end)

By the way, it has no errors for some reason, trail removal only errors in studio.